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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b1da2dacad3a8c40912c20a931287af2a85f6df | 612 | cpp | C++ | iterative_preorder/solution.cpp | kasyap1234/codingproblems | 7368222c5fb67b4796410597f68401654878fee0 | [
"MIT"
] | 1 | 2021-04-15T16:09:52.000Z | 2021-04-15T16:09:52.000Z | iterative_preorder/solution.cpp | kasyap1234/codingproblems | 7368222c5fb67b4796410597f68401654878fee0 | [
"MIT"
] | null | null | null | iterative_preorder/solution.cpp | kasyap1234/codingproblems | 7368222c5fb67b4796410597f68401654878fee0 | [
"MIT"
] | null | null | null | class Solution{
public:
vector<int> preOrder(Node* root)
{
vector<int>ans;
stack<Node*>s;
if(root==NULL){
return ans;
}
s.push(root);
while (!s.empty()){
root=s.top();
ans.push_back(root->data);
s.pop();
if(root->right){
s.push(root->right);
}
if(root->left){
s.push(root->left);
}
}
return ans;
//code here
}
};
| 19.741935 | 39 | 0.330065 |
74502e5bc91a8d765b23be0a8162776ae81c78ba | 4,739 | html | HTML | src/main/resources/templates/deleteJob.html | HPC-Dev/HpcDashboard | 7de972ca5a1fccca3354cab010e4c37b8ba97439 | [
"Apache-2.0"
] | null | null | null | src/main/resources/templates/deleteJob.html | HPC-Dev/HpcDashboard | 7de972ca5a1fccca3354cab010e4c37b8ba97439 | [
"Apache-2.0"
] | 2 | 2021-07-16T22:15:14.000Z | 2021-07-16T22:33:02.000Z | src/main/resources/templates/deleteJob.html | HPC-Dev/HpcDashboard | 7de972ca5a1fccca3354cab010e4c37b8ba97439 | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css"
th:href="@{/webjars/bootstrap/4.4.1-1/css/bootstrap.min.css}" />
<link rel="icon" th:href="@{assets/favicon.ico}" />
<link th:rel="stylesheet" th:href="@{assets/custom/custom.css}"/>
<link th:rel="stylesheet" th:href="@{/webjars/font-awesome/css/all.css}"/>
<title>Delete Job</title>
</head>
<body>
<div th:insert="~{fragments/header :: header}">...</div>
<br>
<br>
<div class="container-fluid" style="max-width:1500px">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h3>Delete Jobs</h3>
<br>
<div th:if="${successMessage}">
<div class="alert alert-success alert-dismissible fade show" role="alert">
<div th:text="${successMessage}"></div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div th:if="${partialSuccess}">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div th:text="${partialSuccess}"></div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div th:if="${notFound}">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div th:text="${notFound}"></div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div th:if="${oneNotFound}">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div th:text="${oneNotFound}"></div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div th:if="${oneJobNotFound}">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div th:text="${oneJobNotFound}"></div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div th:if="${failMessage}">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div th:text="${failMessage}"></div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<form action="#" th:action="@{/deleteJob}" th:object="${command}" method="post" >
<div id="textArea" class="form-group col-sm-6" style=''>
<p class="error-message" th:if="${#fields.hasGlobalErrors()}"
th:each="error : ${#fields.errors('global')}" th:text="${error}">Validation
error</p>
<textarea rows="4" cols="60" th:field="*{textareaField}" ></textarea>
</div>
<div id="submit" class="form-group" style="margin-top:5px;margin-left:15px">
<button type="submit" class="btn btn-success">Submit</button>
</div>
<div id="note" class="card" style="width: 16rem;margin-left:15px; margin-top:40px">
<div class="card-body">
<h6 class="card-title">Note:</h6>
<p class="card-text" style="font-size:13px;" >Pasting Job Ids delimited by <b>comma</b></p>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript"
th:src="@{/webjars/jquery/3.4.1/jquery.min.js}"></script>
<script type="text/javascript"
th:src="@{/webjars/bootstrap/4.4.1-1/js/bootstrap.min.js}"></script>
<script>
</script>
</body>
</html> | 39.491667 | 115 | 0.499472 |
946f98de8a76cde9bb9ac726303397ae09e548c4 | 3,543 | cpp | C++ | Assignments/C-String Library assignment/string6.cpp | umerfarooqpucit/Object-Oriented-Programming | 4b8ef68d7f92c7768f72d0534787e8ac11727a55 | [
"MIT"
] | null | null | null | Assignments/C-String Library assignment/string6.cpp | umerfarooqpucit/Object-Oriented-Programming | 4b8ef68d7f92c7768f72d0534787e8ac11727a55 | [
"MIT"
] | null | null | null | Assignments/C-String Library assignment/string6.cpp | umerfarooqpucit/Object-Oriented-Programming | 4b8ef68d7f92c7768f72d0534787e8ac11727a55 | [
"MIT"
] | null | null | null | /* NAME: MUHAMMAD UMER FAROOQ
ROLL NUM: BCSF15M025
*/
#include<iostream>
using namespace std;
int main()
{
/*
//array for string input
char st[30]={0},
//variable to print the max occurred character(s)
ch={0};
//array to store frequency of alphabets
int alpha[26]={0},
//variable to store max frequency
max=0;
cout<<"Enter a word or sentence:";
cin.getline(st,30);
//loop to check all values of string
for(int i=0;st[i]!='\0';i++)
{
//condition to convert to lower case for convinience.(as case sensitive is not mentioned in the problem).
if(st[i]>='A' && st[i]<='Z')
{
st[i]=st[i]+32;
}
//conditions to check each character and store its frequency in coresponding array location. (0 to 25 -- a to z)
if((st[i]-'a')==0)
{
alpha[0]++;
}
else if((st[i]-'a')==1)
{
alpha[1]++;
}
else if((st[i]-'a')==2)
{
alpha[2]++;
}
else if((st[i]-'a')==3)
{
alpha[3]++;
}
else if((st[i]-'a')==4)
{
alpha[4]++;
}
else if((st[i]-'a')==5)
{
alpha[5]++;
}
else if((st[i]-'a')==6)
{
alpha[6]++;
}
else if((st[i]-'a')==7)
{
alpha[7]++;
}
else if((st[i]-'a')==8)
{
alpha[8]++;
}
else if((st[i]-'a')==9)
{
alpha[9]++;
}
else if((st[i]-'a')==10)
{
alpha[10]++;
}
else if((st[i]-'a')==11)
{
alpha[11]++;
}
else if((st[i]-'a')==12)
{
alpha[12]++;
}
else if((st[i]-'a')==13)
{
alpha[13]++;
}
else if((st[i]-'a')==14)
{
alpha[14]++;
}
else if((st[i]-'a')==15)
{
alpha[15]++;
}
else if((st[i]-'a')==16)
{
alpha[16]++;
}
else if((st[i]-'a')==17)
{
alpha[17]++;
}
else if((st[i]-'a')==18)
{
alpha[18]++;
}
else if((st[i]-'a')==19)
{
alpha[19]++;
}
else if((st[i]-'a')==20)
{
alpha[20]++;
}
else if((st[i]-'a')==21)
{
alpha[21]++;
}
else if((st[i]-'a')==22)
{
alpha[22]++;
}
else if((st[i]-'a')==23)
{
alpha[23]++;
}
else if((st[i]-'a')==24)
{
alpha[24]++;
}
else if((st[i]-'a')==25)
{
alpha[25]++;
}
}
//loop to calculate max frequency
for(int j=0;j<26;j++)
{
if(max<alpha[j])
{
max=alpha[j];
}
}
cout<<"\nHighest character(s):";
//loop to print highest occurred character(s).
for(int i=0;i<26;i++)
{
//checks if any frequency is equal to max frequency then print corresponding character.
if(alpha[i]==max)
{
ch=i+'a';
cout<<ch<<" ";
}
}
*/
//ALTERNATIVE WAY
//array for string input
char st[30]={0},
//variable to print the max occurred character(s)
ch={0};
//array to store frequency of alphabets
int alpha[30]={0},
//variable to store max frequency
max=0;
cout<<"Enter a word or sentence:";
cin.getline(st,30);
//loop to check all values of string
for(int i=0;st[i]!='\0';i++)
{
//condition to convert to lower case for convinience.(as case sensitive is not mentioned in the problem).
if(st[i]>='A' && st[i]<='Z')
{
st[i]=st[i]+32;
}
//conditions to check each character and store its frequency in coresponding array location. (0 to 25 -- a to z)
for(int j=i+1;st[j]!=0;j++)
{
if(st[i]==st[j])
{
alpha[i]++;
}
}
}
//loop to calculate max frequency
for(int j=0;st[j]!=0;j++)
{
if(max<alpha[j])
{
max=alpha[j];
}
}
cout<<"\nHighest character(s):";
//loop to print highest occurred character(s).
for(int i=0;st[i]!=0;i++)
{
//checks if any frequency is equal to max frequency then print corresponding character.
if(alpha[i]==max)
{
cout<<st[i]<<" ";
}
}
}
| 16.47907 | 114 | 0.523568 |
40bb15251983fda1d29064f7300736730c286328 | 351 | py | Python | udp_false_src.py | mario21ic/upc-network | 2db61465be9ab2c5699e3cac13a2833a861fde40 | [
"MIT"
] | null | null | null | udp_false_src.py | mario21ic/upc-network | 2db61465be9ab2c5699e3cac13a2833a861fde40 | [
"MIT"
] | null | null | null | udp_false_src.py | mario21ic/upc-network | 2db61465be9ab2c5699e3cac13a2833a861fde40 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
from scapy.all import *
src_mac = sys.argv[1]
src_ip = sys.argv[2]
dst_ip = sys.argv[3]
#pkg = IP(src=src_ip, dst=dst_ip)/UDP(sport=666, dport=666)/"xD"
pkg = Ether(src=src_mac)/IP(src=src_ip, dst=dst_ip)/UDP(sport=666, dport=666)/"xD"
print(pkg.show())
#print(send(pkg))
print(sendp(pkg))
print(pkg.summary())
| 18.473684 | 82 | 0.68661 |
a18bbbf16cf3122e7ca1ab131df5888effd9a72f | 342 | h | C | engine/Renderer/src/RendererAPI/Cubemap.h | AbyteofteA/MiteVox | 32cbe2e42f05c68b4f545707ef6df28d73d9dd2a | [
"MIT"
] | null | null | null | engine/Renderer/src/RendererAPI/Cubemap.h | AbyteofteA/MiteVox | 32cbe2e42f05c68b4f545707ef6df28d73d9dd2a | [
"MIT"
] | null | null | null | engine/Renderer/src/RendererAPI/Cubemap.h | AbyteofteA/MiteVox | 32cbe2e42f05c68b4f545707ef6df28d73d9dd2a | [
"MIT"
] | null | null | null |
#ifndef RENDERER_CUBEMAP_H
#define RENDERER_CUBEMAP_H
namespace render
{
struct Cubemap
{
Cubemap()
{
}
~Cubemap()
{
for (int i = 0; i < 6; i++)
{
delete &textures[i];
}
}
fileio::Image textures[6];
unsigned int textureID;
};
void loadCubemap(std::string dirname, void** cubemap, char* flag);
}
#endif
| 11.4 | 67 | 0.616959 |
fc6b934261b4a96b7d0f8a4a4b8984a31e959c2b | 1,434 | asm | Assembly | programs/oeis/048/A048058.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/048/A048058.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/048/A048058.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A048058: a(n) = n^2 + n + 11.
; 11,13,17,23,31,41,53,67,83,101,121,143,167,193,221,251,283,317,353,391,431,473,517,563,611,661,713,767,823,881,941,1003,1067,1133,1201,1271,1343,1417,1493,1571,1651,1733,1817,1903,1991,2081,2173,2267,2363,2461,2561,2663,2767,2873,2981,3091,3203,3317,3433,3551,3671,3793,3917,4043,4171,4301,4433,4567,4703,4841,4981,5123,5267,5413,5561,5711,5863,6017,6173,6331,6491,6653,6817,6983,7151,7321,7493,7667,7843,8021,8201,8383,8567,8753,8941,9131,9323,9517,9713,9911,10111,10313,10517,10723,10931,11141,11353,11567,11783,12001,12221,12443,12667,12893,13121,13351,13583,13817,14053,14291,14531,14773,15017,15263,15511,15761,16013,16267,16523,16781,17041,17303,17567,17833,18101,18371,18643,18917,19193,19471,19751,20033,20317,20603,20891,21181,21473,21767,22063,22361,22661,22963,23267,23573,23881,24191,24503,24817,25133,25451,25771,26093,26417,26743,27071,27401,27733,28067,28403,28741,29081,29423,29767,30113,30461,30811,31163,31517,31873,32231,32591,32953,33317,33683,34051,34421,34793,35167,35543,35921,36301,36683,37067,37453,37841,38231,38623,39017,39413,39811,40211,40613,41017,41423,41831,42241,42653,43067,43483,43901,44321,44743,45167,45593,46021,46451,46883,47317,47753,48191,48631,49073,49517,49963,50411,50861,51313,51767,52223,52681,53141,53603,54067,54533,55001,55471,55943,56417,56893,57371,57851,58333,58817,59303,59791,60281,60773,61267,61763,62261
mov $1,$0
add $1,1
mul $1,$0
add $1,11
| 179.25 | 1,361 | 0.798466 |
2668f74ce9d01d069aef76f91a8c486bc406fa62 | 2,431 | java | Java | sample/Triangle_gradle/src/test/java/TriangleTest.java | bloa/pyggi | 79babee583460494b1c533e45e49c7cb23ed70c9 | [
"MIT"
] | 26 | 2018-01-30T13:07:51.000Z | 2021-08-01T13:41:48.000Z | sample/Triangle_gradle/src/test/java/TriangleTest.java | bloa/pyggi | 79babee583460494b1c533e45e49c7cb23ed70c9 | [
"MIT"
] | 9 | 2018-01-10T02:22:10.000Z | 2021-12-08T06:28:19.000Z | sample/Triangle_gradle/src/test/java/TriangleTest.java | bloa/pyggi | 79babee583460494b1c533e45e49c7cb23ed70c9 | [
"MIT"
] | 9 | 2019-02-11T19:00:52.000Z | 2021-12-30T07:48:52.000Z | import static org.junit.Assert.*;
public class TriangleTest {
private void checkClassification(int[][] triangles, Triangle.TriangleType expectedResult) {
for (int[] triangle: triangles) {
Triangle.TriangleType triangleType = Triangle.classifyTriangle(triangle[0], triangle[1], triangle[2]);
assertEquals(expectedResult, triangleType);
}
}
@org.junit.Test
public void testInvalidTriangles() throws Exception {
int[][] invalidTriangles = {
{1, 2, 9}, {1, 9, 2}, {2, 1, 9}, {2, 9, 1}, {9, 1, 2}, {9, 2, 1},
{1, 1, -1}, {1, -1, 1}, {-1, 1, 1},
{100, 80, 10000}, {100, 10000, 80}, {80, 100, 10000}, {80, 10000, 100}, {10000, 100, 80}, {10000, 80, 100},
{1, 2, 1}, {1, 1, 2}, {2, 1, 1}
};
checkClassification(invalidTriangles, Triangle.TriangleType.INVALID);
}
@org.junit.Test
public void testEqualateralTriangles() throws Exception {
int[][] equalateralTriangles = {{1, 1, 1}, {100, 100, 100}, {99, 99, 99}};
checkClassification(equalateralTriangles, Triangle.TriangleType.EQUALATERAL);
}
@org.junit.Test
public void testIsocelesTriangles() throws Exception {
int[][] isocelesTriangles = {
{100, 90, 90}, {90, 100, 90}, {90, 90, 100},
{2, 2, 3}, {2, 3, 2}, {3, 2, 2},
{30, 16, 16}, {16, 30, 16}, {16, 16, 30},
{100, 90, 90}, {1000, 900, 900},
{20, 20, 10}, {20, 10, 20}, {10, 20, 20},
{1, 2, 2}, {2, 1, 2}, {2, 2, 1}
};
checkClassification(isocelesTriangles, Triangle.TriangleType.ISOCELES);
}
@org.junit.Test
public void testScaleneTriangles() throws Exception {
int[][] scaleneTriangles = {
{5, 4, 3}, {5, 3, 4}, {4, 5, 3}, {4, 3, 5}, {3, 5, 4}, {3, 4, 5},
{1000, 900, 101}, {1000, 101, 900}, {900, 1000, 101}, {900, 101, 1000}, {101, 1000, 900}, {101, 900, 1000},
{3, 20, 21}, {3, 21, 20}, {20, 3, 21}, {20, 21, 3}, {21, 3, 20}, {21, 20, 3},
{999, 501, 600}, {999, 600, 501}, {501, 999, 600}, {501, 600, 999}, {600, 999, 501}, {600, 501, 999},
{100, 101, 50}, {100, 50, 101}, {101, 100, 50}, {101, 50, 100}, {50, 100, 101}, {50, 101, 100},
{3, 4, 2}, {3, 2, 4}, {4, 3, 2}, {4, 2, 3}, {2, 3, 4}, {2, 4, 3}
};
checkClassification(scaleneTriangles, Triangle.TriangleType.SCALENE);
}
}
| 43.410714 | 117 | 0.524476 |
a556ff3d2688fb9bff1cfa39a268a057a2db3e51 | 135 | swift | Swift | klashapay/Classes/Services/EndpointType.swift | klasha-apps/ios | 2c6275b53a814814912f5c48303f0ca5a44c506d | [
"MIT"
] | null | null | null | klashapay/Classes/Services/EndpointType.swift | klasha-apps/ios | 2c6275b53a814814912f5c48303f0ca5a44c506d | [
"MIT"
] | null | null | null | klashapay/Classes/Services/EndpointType.swift | klasha-apps/ios | 2c6275b53a814814912f5c48303f0ca5a44c506d | [
"MIT"
] | 1 | 2022-03-21T19:07:39.000Z | 2022-03-21T19:07:39.000Z | import Foundation
protocol EndpointType {
var baseURL: URL { get }
var stagingURL:URL{ get }
var path: String { get }
}
| 13.5 | 29 | 0.644444 |
f96609aee30509a7baf76edd334c4b6fb1cf39ca | 592 | dart | Dart | pizza_worker_app/lib/Model/Orders.dart | phumin1994/HybridMobileAppTasks | eeefd83e85c740d70f4dd2476cdac1ff1b251dbd | [
"MIT"
] | null | null | null | pizza_worker_app/lib/Model/Orders.dart | phumin1994/HybridMobileAppTasks | eeefd83e85c740d70f4dd2476cdac1ff1b251dbd | [
"MIT"
] | null | null | null | pizza_worker_app/lib/Model/Orders.dart | phumin1994/HybridMobileAppTasks | eeefd83e85c740d70f4dd2476cdac1ff1b251dbd | [
"MIT"
] | null | null | null | class Orders {
String orderid,
deliveryboyid,
orderaddress,
orderamount,
orderstatus,
user_id,
customer_name;
Orders(
String orderid,
String deliveryboyid,
String orderaddress,
String orderamount,
String orderstatus,
String user_id,
String customer_name) {
this.deliveryboyid = deliveryboyid;
this.orderid = orderid;
this.orderaddress = orderaddress;
this.orderamount = orderamount;
this.orderstatus = orderstatus;
this.user_id = user_id;
this.customer_name = customer_name;
}
}
| 21.925926 | 39 | 0.657095 |
76281c9fd359c833c4c350ed42e4aae781ec2a7e | 4,071 | kt | Kotlin | wearapp/src/main/java/com/thewizrd/simpleweather/fragments/SwipeDismissPreferenceFragment.kt | SimpleAppProjects/SimpleWeather-Android | 77fd609eeb7de63a56784b41193404ca7983734c | [
"Apache-2.0"
] | 10 | 2020-05-11T10:30:52.000Z | 2022-01-21T07:22:54.000Z | wearapp/src/main/java/com/thewizrd/simpleweather/fragments/SwipeDismissPreferenceFragment.kt | SimpleAppProjects/SimpleWeather-Android | 77fd609eeb7de63a56784b41193404ca7983734c | [
"Apache-2.0"
] | 3 | 2020-08-10T09:12:06.000Z | 2022-03-19T19:23:14.000Z | wearapp/src/main/java/com/thewizrd/simpleweather/fragments/SwipeDismissPreferenceFragment.kt | SimpleAppProjects/SimpleWeather-Android | 77fd609eeb7de63a56784b41193404ca7983734c | [
"Apache-2.0"
] | 3 | 2020-04-08T09:39:57.000Z | 2021-05-29T07:25:51.000Z | package com.thewizrd.simpleweather.fragments
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.IntDef
import androidx.annotation.StringRes
import androidx.lifecycle.lifecycleScope
import androidx.wear.widget.SwipeDismissFrameLayout
import com.thewizrd.shared_resources.utils.SettingsManager
import com.thewizrd.simpleweather.App
import com.thewizrd.simpleweather.databinding.ActivitySettingsBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
abstract class SwipeDismissPreferenceFragment : LifecyclePreferenceFragment() {
@IntDef(Toast.LENGTH_SHORT, Toast.LENGTH_LONG)
@Retention(AnnotationRetention.SOURCE)
annotation class ToastDuration
var parentActivity: Activity? = null
private set
protected val settingsManager: SettingsManager = App.instance.settingsManager
private lateinit var binding: ActivitySettingsBinding
private var swipeCallback: SwipeDismissFrameLayout.Callback? = null
override fun onAttach(context: Context) {
super.onAttach(context)
parentActivity = context as Activity
}
override fun onDetach() {
parentActivity = null
super.onDetach()
}
override fun onDestroy() {
parentActivity = null
super.onDestroy()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
onCreatePreferences(savedInstanceState)
}
@SuppressLint("RestrictedApi")
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = ActivitySettingsBinding.inflate(inflater, container, false)
val inflatedView = super.onCreateView(inflater, container, savedInstanceState)
binding.swipeLayout.addView(inflatedView)
binding.swipeLayout.isSwipeable = true
swipeCallback = object : SwipeDismissFrameLayout.Callback() {
override fun onDismissed(layout: SwipeDismissFrameLayout) {
parentActivity?.onBackPressed()
}
}
binding.swipeLayout.addCallback(swipeCallback)
binding.swipeLayout.requestFocus()
return binding.swipeLayout
}
override fun onDestroyView() {
binding.swipeLayout.removeCallback(swipeCallback)
super.onDestroyView()
}
abstract fun onCreatePreferences(savedInstanceState: Bundle?)
fun showToast(@StringRes resId: Int, @ToastDuration duration: Int) {
lifecycleScope.launch {
if (parentActivity != null && isVisible) {
Toast.makeText(parentActivity, resId, duration).show()
}
}
}
fun showToast(message: CharSequence?, @ToastDuration duration: Int) {
lifecycleScope.launch {
if (parentActivity != null && isVisible) {
Toast.makeText(parentActivity, message, duration).show()
}
}
}
/**
* Launches and runs the given runnable if the fragment is at least initialized
* The action will be signalled to cancel if the fragment goes into the destroyed state
* Note: This will run on the UI thread
*
* @param context additional to [CoroutineScope.coroutineContext] context of the coroutine.
* @param block the coroutine code which will be invoked in the context of the viewLifeCycleOwner lifecycle scope.
*/
fun runWithView(context: CoroutineContext = EmptyCoroutineContext,
block: suspend CoroutineScope.() -> Unit
) {
runCatching {
viewLifecycleOwner.lifecycleScope
}.onFailure {
// no-op
}.onSuccess {
it.launch(context = context, block = block)
}
}
} | 34.794872 | 118 | 0.703021 |
12e91ebdf6e303c883771a1a6b66dcef2f5b1c7e | 1,619 | html | HTML | _layouts/tag.html | shubh7231/shubh7231.github.io | 7c98be53cd9690801b5637ddaa98c35a5fc60917 | [
"Apache-2.0"
] | null | null | null | _layouts/tag.html | shubh7231/shubh7231.github.io | 7c98be53cd9690801b5637ddaa98c35a5fc60917 | [
"Apache-2.0"
] | null | null | null | _layouts/tag.html | shubh7231/shubh7231.github.io | 7c98be53cd9690801b5637ddaa98c35a5fc60917 | [
"Apache-2.0"
] | null | null | null | ---
layout: page
menu: Tags
---
<div class="col-md-8">
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="/tag">tags</a></li>
<li class="active">{{ page.title }}</li>
</ol>
{% assign alltags = site.tags[page.slug] %}
{% unless alltags %}
{% assign alltags = ''| split:',' %}
{% endunless %}
{% for snippet in site.my_snippet %}
{% for tag in snippet.tags %}
{% if tag == page.slug %}
{% assign alltags = alltags | push: snippet %}
{% endif %}
{% endfor %}
{% endfor %}
{% if alltags %}
{% assign alltags = alltags | sort: 'date' | reverse %}
{% for post in alltags %}
<div class="panel panel-default">
<div class="panel-top">
<a href="{{ post.url }}">
<i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> {{ post.title }}
</a>
<small> —— {{ post.date | date: "%Y-%m-%d" }}</small>
</div>
<div class="panel-body">
{{ post.excerpt | strip_html | strip }}
</div>
</div>
{% endfor %}
{% else %}
<p><i class="fa fa-meh-o fa-fw" aria-hidden="true"></i> There are no posts in this tag.</p>
{% endif %}
</div>
<div class="col-md-4">
<div class="btn-label">
<div class="paper-title"> Tag Cloud</div>
{% for tag in site.my_tags %}
{% if site.tags[tag.slug].size > 0 %}
<a href="/tag/{{tag.slug}}" class="btn btn-default">
{{ tag.name }}({{site.tags[tag.slug].size|default:0}})
</a>
{% endif %}
{% endfor %}
</div>
</div> | 29.981481 | 95 | 0.483014 |
80534fce754992bc3ea9d1fe77557042b66be567 | 19,953 | java | Java | src/main/java/com/upokecenter/cbor/CBORDateConverter.java | peteroupc/CBOR-Java | 93fdf394bbfe79a7d4e81389c3fc006cbb016bff | [
"CC0-1.0"
] | 27 | 2016-02-03T17:26:36.000Z | 2022-03-17T14:18:17.000Z | src/main/java/com/upokecenter/cbor/CBORDateConverter.java | peteroupc/CBOR-Java | 93fdf394bbfe79a7d4e81389c3fc006cbb016bff | [
"CC0-1.0"
] | 22 | 2016-02-15T12:01:48.000Z | 2022-01-20T12:09:54.000Z | src/main/java/com/upokecenter/cbor/CBORDateConverter.java | peteroupc/CBOR-Java | 93fdf394bbfe79a7d4e81389c3fc006cbb016bff | [
"CC0-1.0"
] | 9 | 2017-01-16T19:19:47.000Z | 2022-03-29T14:09:49.000Z | package com.upokecenter.cbor;
/*
Written by Peter O.
Any copyright to this work is released to the Public Domain.
In case this is not possible, this work is also
licensed under Creative Commons Zero (CC0):
https://creativecommons.org/publicdomain/zero/1.0/
*/
import com.upokecenter.numbers.*;
/**
* <p>A class for converting date-time objects to and from tagged CBOR
* objects.</p> <p>In this class's documentation, the "number of seconds
* since the start of 1970" is based on the POSIX definition of "seconds
* since the Epoch", a definition that does not count leap seconds. This
* number of seconds assumes the use of a proleptic Gregorian calendar,
* in which the rules regarding the number of days in each month and
* which years are leap years are the same for all years as they were in
* 1970 (including without regard to time zone differences or transitions
* from other calendars to the Gregorian).</p>
*/
public final class CBORDateConverter implements ICBORToFromConverter<java.util.Date> {
private final ConversionType convType;
/**
* A converter object where FromCBORObject accepts CBOR objects with tag 0
* (date/time strings) and tag 1 (number of seconds since the start of
* 1970), and ToCBORObject converts date/time objects (java.util.Date in
* DotNet, and Date in Java) to CBOR objects of tag 0.
*/
public static final CBORDateConverter TaggedString =
new CBORDateConverter(ConversionType.TaggedString);
/**
* A converter object where FromCBORObject accepts CBOR objects with tag 0
* (date/time strings) and tag 1 (number of seconds since the start of
* 1970), and ToCBORObject converts date/time objects (java.util.Date in
* DotNet, and Date in Java) to CBOR objects of tag 1. The ToCBORObject
* conversion is lossless only if the number of seconds since the start
* of 1970 can be represented exactly as an integer in the interval
* [-(2^64), 2^64 - 1] or as a 64-bit floating-point number in the IEEE
* 754r binary64 format; the conversion is lossy otherwise. The
* ToCBORObject conversion will throw an exception if the conversion to
* binary64 results in positive infinity, negative infinity, or
* not-a-number.
*/
public static final CBORDateConverter TaggedNumber =
new CBORDateConverter(ConversionType.TaggedNumber);
/**
* A converter object where FromCBORObject accepts untagged CBOR integer or
* CBOR floating-point objects that give the number of seconds since
* the start of 1970, and where ToCBORObject converts date/time objects
* (java.util.Date in DotNet, and Date in Java) to such untagged CBOR
* objects. The ToCBORObject conversion is lossless only if the number
* of seconds since the start of 1970 can be represented exactly as an
* integer in the interval [-(2^64), 2^64 - 1] or as a 64-bit
* floating-point number in the IEEE 754r binary64 format; the
* conversion is lossy otherwise. The ToCBORObject conversion will
* throw an exception if the conversion to binary64 results in positive
* infinity, negative infinity, or not-a-number.
*/
public static final CBORDateConverter UntaggedNumber =
new CBORDateConverter(ConversionType.UntaggedNumber);
/**
* Conversion type for date-time conversion.
*/
public enum ConversionType {
/**
* FromCBORObject accepts CBOR objects with tag 0 (date/time strings) and tag 1
* (number of seconds since the start of 1970), and ToCBORObject
* converts date/time objects to CBOR objects of tag 0.
*/
TaggedString,
/**
* FromCBORObject accepts objects with tag 0 (date/time strings) and tag 1
* (number of seconds since the start of 1970), and ToCBORObject
* converts date/time objects to CBOR objects of tag 1. The
* ToCBORObject conversion is lossless only if the number of seconds
* since the start of 1970 can be represented exactly as an integer
* in the interval [-(2^64), 2^64 - 1] or as a 64-bit floating-point
* number in the IEEE 754r binary64 format; the conversion is lossy
* otherwise. The ToCBORObject conversion will throw an exception if
* the conversion to binary64 results in positive infinity, negative
* infinity, or not-a-number.
*/
TaggedNumber,
/**
* FromCBORObject accepts untagged CBOR integer or CBOR floating-point objects
* that give the number of seconds since the start of 1970, and
* ToCBORObject converts date/time objects (java.util.Date in DotNet, and
* Date in Java) to such untagged CBOR objects. The ToCBORObject
* conversion is lossless only if the number of seconds since the
* start of 1970 can be represented exactly as an integer in the
* interval [-(2^64), 2^64 - 1] or as a 64-bit floating-point number
* in the IEEE 754r binary64 format; the conversion is lossy
* otherwise. The ToCBORObject conversion will throw an exception if
* the conversion to binary64 results in positive infinity, negative
* infinity, or not-a-number.
*/
UntaggedNumber,
}
/**
* Initializes a new instance of the {@link
* com.upokecenter.cbor.CBORDateConverter} class.
*/
public CBORDateConverter() {
this(ConversionType.TaggedString);
}
/**
* Gets the conversion type for this date converter.
* @return The conversion type for this date converter.
*/
public final ConversionType getType() {
return this.convType;
}
/**
* Initializes a new instance of the {@link
* com.upokecenter.cbor.CBORDateConverter} class.
* @param convType Conversion type giving the rules for converting dates and
* times to and from CBOR objects.
*/
public CBORDateConverter(ConversionType convType) {
this.convType = convType;
}
private static String DateTimeToString(java.util.Date bi) {
try {
int[] lesserFields = new int[7];
EInteger[] outYear = new EInteger[1];
PropertyMap.BreakDownDateTime(bi, outYear, lesserFields);
return CBORUtilities.ToAtomDateTimeString(outYear[0], lesserFields);
} catch (IllegalArgumentException ex) {
throw new CBORException(ex.getMessage(), ex);
}
}
/**
* Converts a CBOR object to a java.util.Date (in DotNet) or a Date (in Java).
* @param obj A CBOR object that specifies a date/time according to the
* conversion type used to create this date converter.
* @return A java.util.Date or Date that encodes the date/time specified in the CBOR
* object.
* @throws NullPointerException The parameter {@code obj} is null.
* @throws com.upokecenter.cbor.CBORException The format of the CBOR object is
* not supported, or another error occurred in conversion.
*/
public java.util.Date FromCBORObject(CBORObject obj) {
if (obj == null) {
throw new NullPointerException("obj");
}
int[] lesserFields = new int[7];
EInteger[] outYear = new EInteger[1];
String str = this.TryGetDateTimeFieldsInternal(
obj,
outYear,
lesserFields);
if (str == null) {
return PropertyMap.BuildUpDateTime(outYear[0], lesserFields);
}
throw new CBORException(str);
}
/**
* Tries to extract the fields of a date and time in the form of a CBOR object.
* @param obj A CBOR object that specifies a date/time according to the
* conversion type used to create this date converter.
* @param year An array whose first element will store the year. The array's
* length must be 1 or greater. If this function fails, the first
* element is set to null.
* @param lesserFields An array that will store the fields (other than the
* year) of the date and time. The array's length must be 7 or greater.
* If this function fails, the first seven elements are set to 0. If
* this method is successful, the first seven elements of the array
* (starting at 0) will be as follows: <ul> <li>0 - Month of the year,
* from 1 (January) through 12 (December).</li> <li>1 - Day of the
* month, from 1 through 31.</li> <li>2 - Hour of the day, from 0
* through 23.</li> <li>3 - Minute of the hour, from 0 through 59.</li>
* <li>4 - Second of the minute, from 0 through 59.</li> <li>5 -
* Fractional seconds, expressed in nanoseconds. This value cannot be
* less than 0 and must be less than 1000*1000*1000.</li> <li>6 -
* Number of minutes to subtract from this date and time to get global
* time. This number can be positive or negative, but cannot be less
* than -1439 or greater than 1439. For tags 0 and 1, this value is
* always 0.</li></ul>.
* @return Either {@code true} if the method is successful, or {@code false}
* otherwise.
* @throws NullPointerException The parameter {@code year} or {@code
* lesserFields} is null, or contains fewer elements than required.
*/
public boolean TryGetDateTimeFields(CBORObject obj, EInteger[] year, int[]
lesserFields) {
// TODO: In next major version, return false instead of throwing an
// exception if the arguments are invalid, to conform to convention
// with Try* methods in DotNet.
if (year == null) {
throw new NullPointerException("year");
}
EInteger[] outYear = year;
if (outYear.length < 1) {
throw new IllegalArgumentException("\"year\" + \"'s length\" (" +
outYear.length + ") is not greater or equal to 1");
}
if (lesserFields == null) {
throw new NullPointerException("lesserFields");
}
if (lesserFields.length < 7) {
throw new IllegalArgumentException("\"lesserFields\" + \"'s length\" (" +
lesserFields.length + ") is not greater or equal to 7");
}
String str = this.TryGetDateTimeFieldsInternal(
obj,
outYear,
lesserFields);
if (str == null) {
// No error String was returned
return true;
} else {
// An error String was returned
outYear[0] = null;
for (int i = 0; i < 7; ++i) {
lesserFields[i] = 0;
}
return false;
}
}
private String TryGetDateTimeFieldsInternal(
CBORObject obj,
EInteger[] year,
int[] lesserFields) {
if (obj == null) {
return "Object is null";
}
if (year == null) {
throw new NullPointerException("year");
}
EInteger[] outYear = year;
if (outYear.length < 1) {
throw new IllegalArgumentException("\"year\" + \"'s length\" (" +
outYear.length + ") is not greater or equal to 1");
}
if (lesserFields == null) {
throw new NullPointerException("lesserFields");
}
if (lesserFields.length < 7) {
throw new IllegalArgumentException("\"lesserFields\" + \"'s length\" (" +
lesserFields.length + ") is not greater or equal to 7");
}
if (this.convType == ConversionType.UntaggedNumber) {
if (obj.isTagged()) {
return "May not be tagged";
}
CBORObject untagobj = obj;
if (!untagobj.isNumber()) {
return "Not a finite number";
}
CBORNumber num = untagobj.AsNumber();
if (!num.IsFinite()) {
return "Not a finite number";
}
if (num.compareTo(Long.MIN_VALUE) < 0 ||
num.compareTo(Long.MAX_VALUE) > 0) {
return "Too big or small to fit a java.util.Date";
}
if (num.CanFitInInt64()) {
CBORUtilities.BreakDownSecondsSinceEpoch(
num.ToInt64Checked(),
outYear,
lesserFields);
} else {
EDecimal dec;
dec = (EDecimal)untagobj.ToObject(EDecimal.class);
CBORUtilities.BreakDownSecondsSinceEpoch(
dec,
outYear,
lesserFields);
}
return null; // no error
}
if (obj.HasMostOuterTag(0)) {
String str = obj.AsString();
try {
CBORUtilities.ParseAtomDateTimeString(str, outYear, lesserFields);
return null; // no error
} catch (ArithmeticException ex) {
return ex.getMessage();
} catch (IllegalStateException ex) {
return ex.getMessage();
} catch (IllegalArgumentException ex) {
return ex.getMessage();
}
} else if (obj.HasMostOuterTag(1)) {
CBORObject untagobj = obj.UntagOne();
if (!untagobj.isNumber()) {
return "Not a finite number";
}
CBORNumber num = untagobj.AsNumber();
if (!num.IsFinite()) {
return "Not a finite number";
}
if (num.CanFitInInt64()) {
CBORUtilities.BreakDownSecondsSinceEpoch(
num.ToInt64Checked(),
outYear,
lesserFields);
} else {
EDecimal dec;
dec = (EDecimal)untagobj.ToObject(EDecimal.class);
CBORUtilities.BreakDownSecondsSinceEpoch(
dec,
outYear,
lesserFields);
}
return null; // No error
}
return "Not tag 0 or 1";
}
/**
* Converts a date/time in the form of a year, month, and day to a CBOR object.
* The hour, minute, and second are treated as 00:00:00 by this method,
* and the time offset is treated as 0 by this method.
* @param smallYear The year.
* @param month Month of the year, from 1 (January) through 12 (December).
* @param day Day of the month, from 1 through 31.
* @return A CBOR object encoding the given date fields according to the
* conversion type used to create this date converter.
* @throws com.upokecenter.cbor.CBORException An error occurred in conversion.
*/
public CBORObject DateTimeFieldsToCBORObject(int smallYear, int month, int
day) {
return this.DateTimeFieldsToCBORObject(EInteger.FromInt32(smallYear),
new int[] { month, day, 0, 0, 0, 0, 0 });
}
/**
* Converts a date/time in the form of a year, month, day, hour, minute, and
* second to a CBOR object. The time offset is treated as 0 by this
* method.
* @param smallYear The year.
* @param month Month of the year, from 1 (January) through 12 (December).
* @param day Day of the month, from 1 through 31.
* @param hour Hour of the day, from 0 through 23.
* @param minute Minute of the hour, from 0 through 59.
* @param second Second of the minute, from 0 through 59.
* @return A CBOR object encoding the given date fields according to the
* conversion type used to create this date converter.
* @throws com.upokecenter.cbor.CBORException An error occurred in conversion.
*/
public CBORObject DateTimeFieldsToCBORObject(
int smallYear,
int month,
int day,
int hour,
int minute,
int second) {
return this.DateTimeFieldsToCBORObject(EInteger.FromInt32(smallYear),
new int[] { month, day, hour, minute, second, 0, 0 });
}
/**
* Converts a date/time in the form of a year, month, day, hour, minute,
* second, fractional seconds, and time offset to a CBOR object.
* @param year The year.
* @param lesserFields An array that will store the fields (other than the
* year) of the date and time. See the TryGetDateTimeFields method for
* information on the "lesserFields" parameter.
* @return A CBOR object encoding the given date fields according to the
* conversion type used to create this date converter.
* @throws NullPointerException The parameter {@code lesserFields} is null.
* @throws com.upokecenter.cbor.CBORException An error occurred in conversion.
*/
public CBORObject DateTimeFieldsToCBORObject(int year, int[]
lesserFields) {
return this.DateTimeFieldsToCBORObject(EInteger.FromInt32(year),
lesserFields);
}
/**
* Converts a date/time in the form of a year, month, day, hour, minute,
* second, fractional seconds, and time offset to a CBOR object.
* @param bigYear The year.
* @param lesserFields An array that will store the fields (other than the
* year) of the date and time. See the TryGetDateTimeFields method for
* information on the "lesserFields" parameter.
* @return A CBOR object encoding the given date fields according to the
* conversion type used to create this date converter.
* @throws NullPointerException The parameter {@code bigYear} or {@code
* lesserFields} is null.
* @throws com.upokecenter.cbor.CBORException An error occurred in conversion.
*/
public CBORObject DateTimeFieldsToCBORObject(EInteger bigYear, int[]
lesserFields) {
if (bigYear == null) {
throw new NullPointerException("bigYear");
}
if (lesserFields == null) {
throw new NullPointerException("lesserFields");
}
// TODO: Make into CBORException in next major version
if (lesserFields.length < 7) {
throw new IllegalArgumentException("\"lesserFields\" + \"'s length\" (" +
lesserFields.length + ") is not greater or equal to 7");
}
try {
CBORUtilities.CheckYearAndLesserFields(bigYear, lesserFields);
switch (this.convType) {
case TaggedString: {
String str = CBORUtilities.ToAtomDateTimeString(bigYear,
lesserFields);
return CBORObject.FromObjectAndTag(str, 0);
}
case TaggedNumber:
case UntaggedNumber:
try {
int[] status = new int[1];
EFloat ef = CBORUtilities.DateTimeToIntegerOrDouble(
bigYear,
lesserFields,
status);
if (status[0] == 0) {
return this.convType == ConversionType.TaggedNumber ?
CBORObject.FromObjectAndTag(ef.ToEInteger(), 1) :
CBORObject.FromObject(ef.ToEInteger());
} else if (status[0] == 1) {
return this.convType == ConversionType.TaggedNumber ?
CBORObject.FromFloatingPointBits(ef.ToDoubleBits(),
8).WithTag(1) : CBORObject.FromFloatingPointBits(ef.ToDoubleBits(), 8);
} else {
throw new CBORException("Too big or small to fit an integer" +
"\u0020or" +
"\u0020floating-point number");
}
} catch (IllegalArgumentException ex) {
throw new CBORException(ex.getMessage(), ex);
}
default:
throw new CBORException("Internal error");
}
} catch (IllegalArgumentException ex) {
throw new CBORException(ex.getMessage(), ex);
}
}
/**
* Converts a java.util.Date (in DotNet) or Date (in Java) to a CBOR object in a
* manner specified by this converter's conversion type.
* @param obj The parameter {@code obj} is a java.util.Date object.
* @return A CBOR object encoding the date/time in the java.util.Date or Date
* according to the conversion type used to create this date converter.
* @throws com.upokecenter.cbor.CBORException An error occurred in conversion.
*/
public CBORObject ToCBORObject(java.util.Date obj) {
try {
int[] lesserFields = new int[7];
EInteger[] outYear = new EInteger[1];
PropertyMap.BreakDownDateTime(obj, outYear, lesserFields);
return this.DateTimeFieldsToCBORObject(outYear[0], lesserFields);
} catch (IllegalArgumentException ex) {
throw new CBORException(ex.getMessage(), ex);
}
}
}
| 42.183932 | 88 | 0.639252 |
6b4deb82996324f219a9fca315aa8b8019c9cc77 | 149 | html | HTML | _includes/header.html | jiggott/jiggott | 252134ada5edbe30c2d97ba1bbcd58de4c8c3d35 | [
"MIT"
] | null | null | null | _includes/header.html | jiggott/jiggott | 252134ada5edbe30c2d97ba1bbcd58de4c8c3d35 | [
"MIT"
] | 5 | 2019-10-21T19:53:51.000Z | 2022-02-26T03:20:42.000Z | _includes/header.html | jiggott/jiggott | 252134ada5edbe30c2d97ba1bbcd58de4c8c3d35 | [
"MIT"
] | null | null | null | <header class="page-header">
<div class="container">
<p><a href="{{ site.url }}" title="Home">James Higgott</a></p>
</div>
</header>
| 24.833333 | 70 | 0.557047 |
86085d487215bae54295be4a66e81dee3b7d63a5 | 308 | dart | Dart | lib/main.dart | arubesu/gif_search | dd166ed8ff0dce53932747249fa5479b0e11bd0e | [
"MIT"
] | null | null | null | lib/main.dart | arubesu/gif_search | dd166ed8ff0dce53932747249fa5479b0e11bd0e | [
"MIT"
] | null | null | null | lib/main.dart | arubesu/gif_search | dd166ed8ff0dce53932747249fa5479b0e11bd0e | [
"MIT"
] | null | null | null | import 'package:flutter_dotenv/flutter_dotenv.dart' as DotEnv;
import 'package:flutter/material.dart';
import 'package:gif_search/pages/home_page.dart';
Future main() async {
await DotEnv.load(fileName: ".env");
runApp(
MaterialApp(home: HomePage(), theme: ThemeData(hintColor: Colors.white)));
}
| 30.8 | 80 | 0.746753 |
f1221af607b7b0210aa4d1863536f9207f94e450 | 30,936 | ps1 | PowerShell | src/Equivalence/Assert-Equivalent.ps1 | ili101/Assert | a889fe0f526cd2735c2f7b7e90039985b275b397 | [
"MIT"
] | 71 | 2017-08-25T19:48:04.000Z | 2022-02-03T16:16:10.000Z | src/Equivalence/Assert-Equivalent.ps1 | ili101/Assert | a889fe0f526cd2735c2f7b7e90039985b275b397 | [
"MIT"
] | 34 | 2017-08-20T04:55:07.000Z | 2021-05-20T19:58:46.000Z | src/Equivalence/Assert-Equivalent.ps1 | ili101/Assert | a889fe0f526cd2735c2f7b7e90039985b275b397 | [
"MIT"
] | 7 | 2017-11-19T19:28:39.000Z | 2021-06-20T16:51:15.000Z | function Test-Same ($Expected, $Actual) {
[object]::ReferenceEquals($Expected, $Actual)
}
function Is-CollectionSize ($Expected, $Actual) {
if ($Expected.Length -is [Int] -and $Actual.Length -is [Int]) {
return $Expected.Length -eq $Actual.Length
}
else {
return $Expected.Count -eq $Actual.Count
}
}
function Is-DataTableSize ($Expected, $Actual) {
return $Expected.Rows.Count -eq $Actual.Rows.Count
}
function Get-ValueNotEquivalentMessage ($Expected, $Actual, $Property, $Options) {
$Expected = Format-Nicely -Value $Expected
$Actual = Format-Nicely -Value $Actual
$propertyInfo = if ($Property) { " property $Property with value" }
$comparison = if ("Equality" -eq $Options.Comparator) { 'equal' } else { 'equivalent' }
"Expected$propertyInfo '$Expected' to be $comparison to the actual value, but got '$Actual'."
}
function Get-CollectionSizeNotTheSameMessage ($Actual, $Expected, $Property) {
$expectedLength = if ($Expected.Length -is [int]) {$Expected.Length} else {$Expected.Count}
$actualLength = if ($Actual.Length -is [int]) {$Actual.Length} else {$Actual.Count}
$Expected = Format-Collection -Value $Expected
$Actual = Format-Collection -Value $Actual
$propertyMessage = $null
if ($property) {
$propertyMessage = " in property $Property with values"
}
"Expected collection$propertyMessage '$Expected' with length '$expectedLength' to be the same size as the actual collection, but got '$Actual' with length '$actualLength'."
}
function Get-DataTableSizeNotTheSameMessage ($Actual, $Expected, $Property) {
$expectedLength = $Expected.Rows.Count
$actualLength = $Actual.Rows.Count
$Expected = Format-Collection -Value $Expected
$Actual = Format-Collection -Value $Actual
$propertyMessage = $null
if ($property) {
$propertyMessage = " in property $Property with values"
}
"Expected DataTable$propertyMessage '$Expected' with length '$expectedLength' to be the same size as the actual DataTable, but got '$Actual' with length '$actualLength'."
}
function Compare-CollectionEquivalent ($Expected, $Actual, $Property, $Options) {
if (-not (Is-Collection -Value $Expected))
{
throw [ArgumentException]"Expected must be a collection."
}
if (-not (Is-Collection -Value $Actual))
{
v -Difference "`$Actual is not a collection it is a $(Format-Nicely (Get-Type $Actual)), so they are not equivalent."
$expectedFormatted = Format-Collection -Value $Expected
$expectedLength = $expected.Length
$actualFormatted = Format-Nicely -Value $actual
return "Expected collection '$expectedFormatted' with length '$expectedLength', but got '$actualFormatted'."
}
if (-not (Is-CollectionSize -Expected $Expected -Actual $Actual)) {
v -Difference "`$Actual does not have the same size ($($Actual.Length)) as `$Expected ($($Expected.Length)) so they are not equivalent."
return Get-CollectionSizeNotTheSameMessage -Expected $Expected -Actual $Actual -Property $Property
}
$eEnd = if ($Expected.Length -is [int]) {$Expected.Length} else {$Expected.Count}
$aEnd = if ($Actual.Length -is [int]) {$Actual.Length} else {$Actual.Count}
v "Comparing items in collection, `$Expected has lenght $eEnd, `$Actual has length $aEnd."
$taken = @()
$notFound = @()
$anyDifferent = $false
for ($e=0; $e -lt $eEnd; $e++) {
# todo: retest strict order
v "`nSearching for `$Expected[$e]:"
$currentExpected = $Expected[$e]
$found = $false
if ($StrictOrder) {
$currentActual = $Actual[$e]
if ($taken -notcontains $e -and (-not (Compare-Equivalent -Expected $currentExpected -Actual $currentActual -Path $Property -Options $Options)))
{
$taken += $e
$found = $true
v -Equivalence "`Found `$Expected[$e]."
}
}
else {
for ($a=0; $a -lt $aEnd; $a++) {
# we already took this item as equivalent to an item
# in the expected collection, skip it
if ($taken -contains $a) {
v "Skipping `$Actual[$a] because it is already taken."
continue }
$currentActual = $Actual[$a]
# -not, because $null means no differences, and some strings means there are differences
v "Comparing `$Actual[$a] to `$Expected[$e] to see if they are equivalent."
if (-not (Compare-Equivalent -Expected $currentExpected -Actual $currentActual -Path $Property -Options $Options))
{
# add the index to the list of taken items so we can skip it
# in the search, this way we can compare collections with
# arrays multiple same items
$taken += $a
$found = $true
v -Equivalence "`Found equivalent item for `$Expected[$e] at `$Actual[$a]."
# we already found the item we
# can move on to the next item in Exected array
break
}
}
}
if (-not $found)
{
v -Difference "`$Actual does not contain `$Expected[$e]."
$anyDifferent = $true
$notFound += $currentExpected
}
}
# do not depend on $notFound collection here
# failing to find a single $null, will return
# @($null) which evaluates to false, even though
# there was a single item that we did not find
if ($anyDifferent) {
v -Difference "`$Actual and `$Expected arrays are not equivalent."
$Expected = Format-Nicely -Value $Expected
$Actual = Format-Nicely -Value $Actual
$notFoundFormatted = Format-Nicely -Value ( $notFound | ForEach-Object { Format-Nicely -Value $_ } )
$propertyMessage = if ($Property) {" in property $Property which is"}
return "Expected collection$propertyMessage '$Expected' to be equivalent to '$Actual' but some values were missing: '$notFoundFormatted'."
}
v -Equivalence "`$Actual and `$Expected arrays are equivalent."
}
function Compare-DataTableEquivalent ($Expected, $Actual, $Property, $Options) {
if (-not (Is-DataTable -Value $Expected)) {
throw [ArgumentException]"Expected must be a DataTable."
}
if (-not (Is-DataTable -Value $Actual)) {
$expectedFormatted = Format-Collection -Value $Expected
$expectedLength = $expected.Rows.Count
$actualFormatted = Format-Nicely -Value $actual
return "Expected DataTable '$expectedFormatted' with length '$expectedLength', but got '$actualFormatted'."
}
if (-not (Is-DataTableSize -Expected $Expected -Actual $Actual)) {
return Get-DataTableSizeNotTheSameMessage -Expected $Expected -Actual $Actual -Property $Property
}
$eEnd = $Expected.Rows.Count
$aEnd = $Actual.Rows.Count
$taken = @()
$notFound = @()
for ($e = 0; $e -lt $eEnd; $e++) {
$currentExpected = $Expected.Rows[$e]
$found = $false
if ($StrictOrder) {
$currentActual = $Actual.Rows[$e]
if ((-not (Compare-Equivalent -Expected $currentExpected -Actual $currentActual -Path $Property -Options $Options)) -and $taken -notcontains $e) {
$taken += $e
$found = $true
}
}
else {
for ($a = 0; $a -lt $aEnd; $a++) {
$currentActual = $Actual.Rows[$a]
if ((-not (Compare-Equivalent -Expected $currentExpected -Actual $currentActual -Path $Property -Options $Options)) -and $taken -notcontains $a) {
$taken += $a
$found = $true
}
}
}
if (-not $found) {
$notFound += $currentExpected
}
}
$Expected = Format-Nicely -Value $Expected
$Actual = Format-Nicely -Value $Actual
$notFoundFormatted = Format-Nicely -Value ( $notFound | ForEach-Object { Format-Nicely -Value $_ } )
if ($notFound) {
$propertyMessage = if ($Property) {" in property $Property which is"}
return "Expected DataTable$propertyMessage '$Expected' to be equivalent to '$Actual' but some values were missing: '$notFoundFormatted'."
}
}
function Compare-ValueEquivalent ($Actual, $Expected, $Property, $Options) {
$Expected = $($Expected)
if (-not (Is-Value -Value $Expected))
{
throw [ArgumentException]"Expected must be a Value."
}
# we don't specify the options in some tests so here we make
# sure that equivalency is used as the default
# not ideal but better than rewriting 100 tests
if (($null -eq $Options) -or
($null -eq $Options.Comparator) -or
("Equivalency" -eq $Options.Comparator)) {
v "Equivalency comparator is used, values will be compared for equivalency."
# fix that string 'false' becomes $true boolean
if ($Actual -is [Bool] -and $Expected -is [string] -and "$Expected" -eq 'False')
{
v "`$Actual is a boolean, and `$Expected is a 'False' string, which we consider equivalent to boolean `$false. Setting `$Expected to `$false."
$Expected = $false
if ($Expected -ne $Actual)
{
v -Difference "`$Actual is not equivalent to $(Format-Nicely $Expected) because it is $(Format-Nicely $Actual)."
return Get-ValueNotEquivalentMessage -Expected $Expected -Actual $Actual -Property $Property -Options $Options
}
v -Equivalence "`$Actual is equivalent to $(Format-Nicely $Expected) because it is $(Format-Nicely $Actual)."
return
}
if ($Expected -is [Bool] -and $Actual -is [string] -and "$Actual" -eq 'False')
{
v "`$Actual is a 'False' string, which we consider equivalent to boolean `$false. `$Expected is a boolean. Setting `$Actual to `$false."
$Actual = $false
if ($Expected -ne $Actual)
{
v -Difference "`$Actual is not equivalent to $(Format-Nicely $Expected) because it is $(Format-Nicely $Actual)."
return Get-ValueNotEquivalentMessage -Expected $Expected -Actual $Actual -Property $Property -Options $Options
}
v -Equivalence "`$Actual is equivalent to $(Format-Nicely $Expected) because it is $(Format-Nicely $Actual)."
return
}
#fix that scriptblocks are compared by reference
if (Is-ScriptBlock -Value $Expected)
{
# todo: compare by equivalency like strings?
v "`$Expected is a ScriptBlock, scriptblocks are considered equivalent when their content is equal. Converting `$Expected to string."
#forcing scriptblock to serialize to string and then comparing that
if ("$Expected" -ne $Actual)
{
# todo: difference on index?
v -Difference "`$Actual is not equivalent to `$Expected because their contents differ."
return Get-ValueNotEquivalentMessage -Expected $Expected -Actual $Actual -Property $Path -Options $Options
}
v -Equivalence "`$Actual is equivalent to `$Expected because their contents are equal."
return
}
}
else
{
v "Equality comparator is used, values will be compared for equality."
}
v "Comparing values as $(Format-Nicely (Get-Type $Expected)) because `$Expected has that type."
# todo: shorter messages when both sides have the same type (do not compare by using -is, instead query the type and compare it) because -is is true even for parent types
$type = Get-Type $Expected
$coalescedActual = $Actual -as $type
if ($Expected -ne $Actual)
{
v -Difference "`$Actual is not equivalent to $(Format-Nicely $Expected) because it is $(Format-Nicely $Actual), and $(Format-Nicely $Actual) coalesced to $(Format-Nicely $type) is $(Format-Nicely $coalescedActual)."
return Get-ValueNotEquivalentMessage -Expected $Expected -Actual $Actual -Property $Property -Options $Options
}
v -Equivalence "`$Actual is equivalent to $(Format-Nicely $Expected) because it is $(Format-Nicely $Actual), and $(Format-Nicely $Actual) coalesced to $(Format-Nicely $type) is $(Format-Nicely $coalescedActual)."
}
function Compare-HashtableEquivalent ($Actual, $Expected, $Property, $Options) {
if (-not (Is-Hashtable -Value $Expected))
{
throw [ArgumentException]"Expected must be a hashtable."
}
if (-not (Is-Hashtable -Value $Actual))
{
v -Difference "`$Actual is not a hashtable it is a $(Format-Nicely (Get-Type $Actual)), so they are not equivalent."
$expectedFormatted = Format-Nicely -Value $Expected
$actualFormatted = Format-Nicely -Value $Actual
return "Expected hashtable '$expectedFormatted', but got '$actualFormatted'."
}
# todo: if either side or both sides are empty hashtable make the verbose output shorter and nicer
$actualKeys = $Actual.Keys
$expectedKeys = $Expected.Keys
v "`Comparing all ($($expectedKeys.Count)) keys from `$Expected to keys in `$Actual."
$result = @()
foreach ($k in $expectedKeys)
{
if (-not (Test-IncludedPath -PathSelector Hashtable -Path $Property -Options $Options -InputObject $k)) {
continue
}
$actualHasKey = $actualKeys -contains $k
if (-not $actualHasKey)
{
v -Difference "`$Actual is missing key '$k'."
$result += "Expected has key '$k' that the other object does not have."
continue
}
$expectedValue = $Expected[$k]
$actualValue = $Actual[$k]
v "Both `$Actual and `$Expected have key '$k', comparing thier contents."
$result += Compare-Equivalent -Expected $expectedValue -Actual $actualValue -Path "$Property.$k" -Options $Options
}
if (!$Options.ExcludePathsNotOnExpected) {
# fix for powershell 2 where the array needs to be explicit
$keysNotInExpected = @( $actualKeys | Where-Object { $expectedKeys -notcontains $_ })
$filteredKeysNotInExpected = @( $keysNotInExpected | Test-IncludedPath -PathSelector Hashtable -Path $Property -Options $Options)
# fix for powershell v2 where foreach goes once over null
if ($filteredKeysNotInExpected | Where-Object { $_ }) {
v -Difference "`$Actual has $($filteredKeysNotInExpected.Count) keys that were not found on `$Expected: $(Format-Nicely @($filteredKeysNotInExpected))."
}
else {
v "`$Actual has no keys that we did not find on `$Expected."
}
foreach ($k in $filteredKeysNotInExpected | Where-Object { $_ })
{
$result += "Expected is missing key '$k' that the other object has."
}
}
if ($result | Where-Object { $_ })
{
v -Difference "Hashtables `$Actual and `$Expected are not equivalent."
$expectedFormatted = Format-Nicely -Value $Expected
$actualFormatted = Format-Nicely -Value $Actual
return "Expected hashtable '$expectedFormatted', but got '$actualFormatted'.`n$($result -join "`n")"
}
v -Equivalence "Hastables `$Actual and `$Expected are equivalent."
}
function Compare-DictionaryEquivalent ($Actual, $Expected, $Property, $Options) {
if (-not (Is-Dictionary -Value $Expected))
{
throw [ArgumentException]"Expected must be a dictionary."
}
if (-not (Is-Dictionary -Value $Actual))
{
v -Difference "`$Actual is not a dictionary it is a $(Format-Nicely (Get-Type $Actual)), so they are not equivalent."
$expectedFormatted = Format-Nicely -Value $Expected
$actualFormatted = Format-Nicely -Value $Actual
return "Expected dictionary '$expectedFormatted', but got '$actualFormatted'."
}
# todo: if either side or both sides are empty dictionary make the verbose output shorter and nicer
$actualKeys = $Actual.Keys
$expectedKeys = $Expected.Keys
v "`Comparing all ($($expectedKeys.Count)) keys from `$Expected to keys in `$Actual."
$result = @()
foreach ($k in $expectedKeys)
{
if (-not (Test-IncludedPath -PathSelector Hashtable -Path $Property -Options $Options -InputObject $k)) {
continue
}
$actualHasKey = $actualKeys -contains $k
if (-not $actualHasKey)
{
v -Difference "`$Actual is missing key '$k'."
$result += "Expected has key '$k' that the other object does not have."
continue
}
$expectedValue = $Expected[$k]
$actualValue = $Actual[$k]
v "Both `$Actual and `$Expected have key '$k', comparing thier contents."
$result += Compare-Equivalent -Expected $expectedValue -Actual $actualValue -Path "$Property.$k" -Options $Options
}
if (!$Options.ExcludePathsNotOnExpected) {
# fix for powershell 2 where the array needs to be explicit
$keysNotInExpected = @( $actualKeys | Where-Object { $expectedKeys -notcontains $_ } )
$filteredKeysNotInExpected = @( $keysNotInExpected | Test-IncludedPath -PathSelector Hashtable -Path $Property -Options $Options )
# fix for powershell v2 where foreach goes once over null
if ($filteredKeysNotInExpected | Where-Object { $_ }) {
v -Difference "`$Actual has $($filteredKeysNotInExpected.Count) keys that were not found on `$Expected: $(Format-Nicely @($filteredKeysNotInExpected))."
}
else {
v "`$Actual has no keys that we did not find on `$Expected."
}
foreach ($k in $filteredKeysNotInExpected | Where-Object { $_ })
{
$result += "Expected is missing key '$k' that the other object has."
}
}
if ($result)
{
v -Difference "Dictionaries `$Actual and `$Expected are not equivalent."
$expectedFormatted = Format-Nicely -Value $Expected
$actualFormatted = Format-Nicely -Value $Actual
return "Expected dictionary '$expectedFormatted', but got '$actualFormatted'.`n$($result -join "`n")"
}
v -Equivalence "Dictionaries `$Actual and `$Expected are equivalent."
}
function Compare-ObjectEquivalent ($Actual, $Expected, $Property, $Options) {
if (-not (Is-Object -Value $Expected))
{
throw [ArgumentException]"Expected must be an object."
}
if (-not (Is-Object -Value $Actual)) {
v -Difference "`$Actual is not an object it is a $(Format-Nicely (Get-Type $Actual)), so they are not equivalent."
$expectedFormatted = Format-Nicely -Value $Expected
$actualFormatted = Format-Nicely -Value $Actual
return "Expected object '$expectedFormatted', but got '$actualFormatted'."
}
$actualProperties = $Actual.PsObject.Properties
$expectedProperties = $Expected.PsObject.Properties
v "Comparing ($(@($expectedProperties).Count)) properties of `$Expected to `$Actual."
foreach ($p in $expectedProperties)
{
if (-not (Test-IncludedPath -PathSelector Property -InputObject $p -Options $Options -Path $Property))
{
continue
}
$propertyName = $p.Name
$actualProperty = $actualProperties | Where-Object { $_.Name -eq $propertyName}
if (-not $actualProperty)
{
v -Difference "Property '$propertyName' was not found on `$Actual."
"Expected has property '$PropertyName' that the other object does not have."
continue
}
v "Property '$propertyName` was found on `$Actual, comparing them for equivalence."
$differences = Compare-Equivalent -Expected $p.Value -Actual $actualProperty.Value -Path "$Property.$propertyName" -Options $Options
if (-not $differences) {
v -Equivalence "Property '$propertyName` is equivalent."
}
else {
v -Difference "Property '$propertyName` is not equivalent."
}
$differences
}
if (!$Options.ExcludePathsNotOnExpected) {
#check if there are any extra actual object props
$expectedPropertyNames = $expectedProperties | Select-Object -ExpandProperty Name
$propertiesNotInExpected = @( $actualProperties | Where-Object { $expectedPropertyNames -notcontains $_.name })
# fix for powershell v2 we need to make the array explicit
$filteredPropertiesNotInExpected = $propertiesNotInExpected |
Test-IncludedPath -PathSelector Property -Options $Options -Path $Property
if ($filteredPropertiesNotInExpected) {
v -Difference "`$Actual has ($(@($filteredPropertiesNotInExpected).Count)) properties that `$Expected does not have: $(Format-Nicely @($filteredPropertiesNotInExpected))."
}
else {
v -Equivalence "`$Actual has no extra properties that `$Expected does not have."
}
# fix for powershell v2 where foreach goes once over null
foreach ($p in $filteredPropertiesNotInExpected | Where-Object { $_ })
{
"Expected is missing property '$($p.Name)' that the other object has."
}
}
}
function Compare-DataRowEquivalent ($Actual, $Expected, $Property, $Options) {
if (-not (Is-DataRow -Value $Expected))
{
throw [ArgumentException]"Expected must be a DataRow."
}
if (-not (Is-DataRow -Value $Actual)) {
$expectedFormatted = Format-Nicely -Value $Expected
$actualFormatted = Format-Nicely -Value $Actual
return "Expected DataRow '$expectedFormatted', but got '$actualFormatted'."
}
$actualProperties = $Actual.PsObject.Properties | Where-Object {'RowError','RowState','Table','ItemArray','HasErrors' -notcontains $_.Name }
$expectedProperties = $Expected.PsObject.Properties | Where-Object {'RowError','RowState','Table','ItemArray','HasErrors' -notcontains $_.Name }
foreach ($p in $expectedProperties)
{
$propertyName = $p.Name
$actualProperty = $actualProperties | Where-Object { $_.Name -eq $propertyName}
if (-not $actualProperty)
{
"Expected has property '$PropertyName' that the other object does not have."
continue
}
Compare-Equivalent -Expected $p.Value -Actual $actualProperty.Value -Path "$Property.$propertyName" -Options $Options
}
#check if there are any extra actual object props
$expectedPropertyNames = $expectedProperties | Select-Object -ExpandProperty Name
$propertiesNotInExpected = @($actualProperties | Where-Object {$expectedPropertyNames -notcontains $_.name })
# fix for powershell v2 where foreach goes once over null
foreach ($p in $propertiesNotInExpected | Where-Object { $_ })
{
"Expected is missing property '$($p.Name)' that the other object has."
}
}
function v {
[CmdletBinding()]
param(
[String] $String,
[Switch] $Difference,
[Switch] $Equivalence,
[Switch] $Skip
)
# we are using implict variable $Path
# from the parent scope, this is ugly
# and bad practice, but saves us ton of
# coding and boilerplate code
$p = ""
$p += if ($null -ne $Path) {
"($Path)"
}
$p += if ($Difference) {
" DIFFERENCE"
}
$p += if ($Equivalence) {
" EQUIVALENCE"
}
$p += if ($Skip) {
" SKIP"
}
$p += if (""-ne $p) {
" - "
}
Write-Verbose ("$p$String".Trim() + " ")
}
# compares two objects for equivalency and returns $null when they are equivalent
# or a string message when they are not
function Compare-Equivalent {
[CmdletBinding()]
param(
$Actual,
$Expected,
$Path,
$Options = (&{
Write-Warning "Getting default equivalency options, this should never be seen. If you see this and you are not developing Assert, please file issue at https://github.com/nohwnd/Assert/issues"
Get-EquivalencyOption
})
)
if ($null -ne $Options.ExludedPaths -and $Options.ExcludedPaths -contains $Path) {
v -Skip "Current path '$Path' is excluded from the comparison."
return
}
#start by null checks to avoid implementing null handling
#logic in the functions that follow
if ($null -eq $Expected)
{
v "`$Expected is `$null, so we are expecting `$null."
if ($Expected -ne $Actual)
{
v -Difference "`$Actual is not equivalent to $(Format-Nicely $Expected), because it has a value of type $(Format-Nicely $Actual.GetType())."
return Get-ValueNotEquivalentMessage -Expected $Expected -Actual $Actual -Property $Path -Options $Options
}
# we terminate here, either we passed the test and return nothing, or we did not
# and the previous statement returned message
v -Equivalence "`$Actual is equivalent to `$null, because it is `$null."
return
}
if ($null -eq $Actual)
{
v -Difference "`$Actual is $(Format-Nicely), but `$Expected has value of type $(Format-Nicely Get-Type $Expected), so they are not equivalent."
return Get-ValueNotEquivalentMessage -Expected $Expected -Actual $Actual -Property $Path
}
v "`$Expected has type $(Get-Type $Expected), `$Actual has type $(Get-Type $Actual), they are both non-null."
#test value types, strings, and single item arrays with values in them as values
#expand the single item array to get to the value in it
if (Is-Value -Value $Expected)
{
v "`$Expected is a value (value type, string, single value array, or a scriptblock), we will be comparing `$Actual to value types."
Compare-ValueEquivalent -Actual $Actual -Expected $Expected -Property $Path -Options $Options
return
}
#are the same instance
if (Test-Same -Expected $Expected -Actual $Actual)
{
v -Equivalence "`$Expected and `$Actual are equivalent because they are the same object (by reference)."
return
}
if (Is-Hashtable -Value $Expected)
{
v "`$Expected is a hashtable, we will be comparing `$Actual to hashtables."
Compare-HashtableEquivalent -Expected $Expected -Actual $Actual -Property $Path -Options $Options
return
}
# dictionaries? (they are IEnumerable so they must go before collections)
if (Is-Dictionary -Value $Expected)
{
v "`$Expected is a dictionary, we will be comparing `$Actual to dictionaries."
Compare-DictionaryEquivalent -Expected $Expected -Actual $Actual -Property $Path -Options $Options
return
}
#compare DataTable
if (Is-DataTable -Value $Expected) {
# todo add verbose output to data table
v "`$Expected is a datatable, we will be comparing `$Actual to datatables."
Compare-DataTableEquivalent -Expected $Expected -Actual $Actual -Property $Path -Options $Options
return
}
#compare collection
if (Is-Collection -Value $Expected) {
v "`$Expected is a collection, we will be comparing `$Actual to collections."
Compare-CollectionEquivalent -Expected $Expected -Actual $Actual -Property $Path -Options $Options
return
}
#compare DataRow
if (Is-DataRow -Value $Expected) {
# todo add verbose output to data row
v "`$Expected is a datarow, we will be comparing `$Actual to datarows."
Compare-DataRowEquivalent -Expected $Expected -Actual $Actual -Property $Path -Options $Options
return
}
v "`$Expected is an object of type $(Get-Type $Expected), we will be comparing `$Actual to objects."
Compare-ObjectEquivalent -Expected $Expected -Actual $Actual -Property $Path -Options $Options
}
function Assert-Equivalent {
[CmdletBinding()]
param(
$Actual,
$Expected,
$Options = (Get-EquivalencyOption),
[Switch] $StrictOrder
)
$areDifferent = Compare-Equivalent -Actual $Actual -Expected $Expected -Options $Options | Out-String
if ($areDifferent)
{
$optionsFormatted = Format-EquivalencyOptions -Options $Options
# the paremeter is -Option not -Options
$message = Get-AssertionMessage -Actual $actual -Expected $Expected -Option $optionsFormatted -Pretty -CustomMessage "Expected and actual are not equivalent!`nExpected:`n<expected>`n`nActual:`n<actual>`n`nSummary:`n$areDifferent`n<options>"
throw [Assertions.AssertionException]$message
}
v -Equivalence "`$Actual and `$Expected are equivalent."
}
function Get-EquivalencyOption {
param(
[string[]] $ExcludePath = @(),
[switch] $ExcludePathsNotOnExpected,
[ValidateSet('Equivalency', 'Equality')]
[string] $Comparator = 'Equivalency'
)
[PSCustomObject]@{
ExcludedPaths = [string[]] $ExcludePath
ExcludePathsNotOnExpected = [bool] $ExcludePathsNotOnExpected
Comparator = [string] $Comparator
}
}
function Test-IncludedPath {
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
$InputObject,
[String]
$Path,
$Options,
[Parameter(Mandatory=$true)]
[ValidateSet("Property", "Hashtable")]
$PathSelector
)
begin {
$selector = switch ($PathSelector) {
"Property" { { param($InputObject) $InputObject.Name } }
"Hashtable" { { param($InputObject) $InputObject } }
Default {throw "Unsupported path selector."}
}
}
process {
if ($null -eq $Options.ExcludedPaths)
{
return $InputObject
}
$subPath = &$selector $InputObject
$fullPath = "$Path.$subPath".Trim('.')
if ($fullPath | Like-Any $Options.ExcludedPaths)
{
v -Skip "Current path $fullPath is excluded from the comparison."
}
else
{
$InputObject
}
}
}
function Format-EquivalencyOptions ($Options) {
$Options.ExcludedPaths | ForEach-Object { "Exclude path '$_'" }
if ($Options.ExcludePathsNotOnExpected) { "Excluding all paths not found on Expected" }
}
function Like-Any {
param(
[String[]] $PathFilters,
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[String] $Path
)
process {
foreach ($pathFilter in $PathFilters | Where-Object { $_ }) {
$r = $Path -like $pathFilter
if ($r) {
v -Skip "Path '$Path' matches filter '$pathFilter'."
return $true
}
}
return $false
}
} | 40.812665 | 248 | 0.625097 |
ebb89e86e8c0cc7f1d69e6a477ead0f9f8cd0511 | 1,973 | sql | SQL | sql/type_users.sql | susananzth/Movimoto | 423ca544192a3dea0f39e62da6d5c95066c006f9 | [
"MIT"
] | 1 | 2020-02-14T02:11:40.000Z | 2020-02-14T02:11:40.000Z | sql/type_users.sql | susananzth/Movimoto | 423ca544192a3dea0f39e62da6d5c95066c006f9 | [
"MIT"
] | 5 | 2020-04-13T23:10:25.000Z | 2021-10-06T10:43:13.000Z | sql/type_users.sql | susananzth/Movimoto | 423ca544192a3dea0f39e62da6d5c95066c006f9 | [
"MIT"
] | 1 | 2020-12-18T04:49:22.000Z | 2020-12-18T04:49:22.000Z | -- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 16-04-2020 a las 15:48:31
-- Versión del servidor: 10.4.8-MariaDB
-- Versión de PHP: 7.3.10
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 */;
--
-- Base de datos: `movimoto`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `type_users`
--
CREATE TABLE `type_users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`modified_by` int(11) DEFAULT 1,
`status` tinyint(1) DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `type_users`
--
INSERT INTO `type_users` (`id`, `name`, `created_at`, `updated_at`, `deleted_at`, `modified_by`, `status`) VALUES
(1, 'Cliente', '2020-04-13 05:00:00', NULL, NULL, 1, 1),
(2, 'Empresa', '2020-04-13 05:00:00', NULL, NULL, 1, 1),
(3, 'Admin', '2020-04-16 05:00:00', NULL, NULL, 1, 1);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `type_users`
--
ALTER TABLE `type_users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `type_users`
--
ALTER TABLE `type_users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 26.662162 | 113 | 0.688292 |
d2552bb0bd641650f951d39564e0c09514e0416a | 3,073 | swift | Swift | Tests/DDXNetworkTests/RequestWorkerTests.swift | dedeexe/DDXNetwork | 24f4a593947ca88032bf5ba6b8bc19aa8bdb9fd2 | [
"MIT"
] | null | null | null | Tests/DDXNetworkTests/RequestWorkerTests.swift | dedeexe/DDXNetwork | 24f4a593947ca88032bf5ba6b8bc19aa8bdb9fd2 | [
"MIT"
] | 1 | 2020-08-27T18:17:35.000Z | 2020-08-27T18:18:10.000Z | Tests/DDXNetworkTests/RequestWorkerTests.swift | dedeexe/DDXNetwork | 24f4a593947ca88032bf5ba6b8bc19aa8bdb9fd2 | [
"MIT"
] | 2 | 2020-03-27T02:05:35.000Z | 2020-08-27T18:05:51.000Z | import XCTest
@testable import DDXNetwork
class RequestWorkerTests: XCTestCase {
var sut: RequestWorker!
var mockedHttp: HttpService!
func testSuccessRawData() {
let model = TestModel(dailyPhrase: "A1B2C3D4", value: 12345)
setupSut(response: .success, successData: model.serialized())
sut.requestData(from: Request()) { result in
switch result {
case .success(let resultData):
XCTAssertEqual(resultData, model.serialized().data(using: .utf8)!)
default:
XCTFail("This test was expecting a success result")
}
}
}
func testFailRawData() {
setupSut(response: .error, successData: "")
sut.requestData(from: Request()) { result in
switch result {
case .failure(let error as NSError):
XCTAssertEqual(error.code, 404)
XCTAssertEqual(error.domain, "Not Found")
XCTAssertNotEqual(error.domain, "Not found")
default:
XCTFail("This test was expecting a fail result")
}
}
}
func testSuccessDecodedObject() {
let model = TestModel(dailyPhrase: "A1B2C3D4", value: 12345)
setupSut(response: .success, successData: model.serialized())
sut.request(TestModel.self, from: Request()) { result in
switch result {
case .success(let resultModel):
XCTAssertEqual(resultModel, model)
default:
XCTFail("This test was expecting a success result")
}
}
}
// -------------------------
func setupSut(response: HttpMock.ResponseType, successData: String) {
mockedHttp = HttpMock(responseType: response,
successData: successData)
sut = RequestWorker(http: mockedHttp)
}
}
// --------------------------------------------------
// =======
// HELPERS
// =======
class HttpMock: HttpService {
enum ResponseType {
case success
case error
}
var response: ResponseType
var successData: String
init(responseType: ResponseType, successData: String) {
self.response = responseType
self.successData = successData
}
func request(_ req: RequestModel, additionalHeaders: HttpHeaders, completion: HttpCompletion?) {
if response == .error {
let error = NSError(domain: "Not Found", code: 404, userInfo: [:])
completion?(.failure(error))
return
}
let result = successData.data(using: .utf8)!
completion?(.success(result))
}
}
struct Request: RequestModel {
var url: String = ""
var method: HttpMethod = .get
var body: HttpBody?
var headers: HttpHeaders = [:]
var timeout: TimeInterval = 30
}
struct TestModel: Decodable, Equatable {
let dailyPhrase: String
let value: Int
func serialized() -> String {
return "{\"daily_phrase\":\"\(dailyPhrase)\", \"value\": \(value)}"
}
}
| 27.19469 | 100 | 0.572079 |
7ee9d511a60f5549c54bbe3ee75863c064773775 | 5,028 | lua | Lua | Interface/AddOns/RayUI/init.lua | Witnesscm/RayUI | 0489bcf82723651e3967a786e702f824a09eb647 | [
"MIT"
] | 88 | 2015-01-10T05:10:05.000Z | 2019-07-13T17:52:33.000Z | Interface/AddOns/RayUI/init.lua | Witnesscm/RayUI | 0489bcf82723651e3967a786e702f824a09eb647 | [
"MIT"
] | 105 | 2015-02-07T09:57:39.000Z | 2019-10-30T08:39:38.000Z | Interface/AddOns/RayUI/init.lua | Witnesscm/RayUI | 0489bcf82723651e3967a786e702f824a09eb647 | [
"MIT"
] | 91 | 2015-01-01T18:45:36.000Z | 2020-06-30T20:26:37.000Z | ----------------------------------------------------------
-- Load RayUI Environment
----------------------------------------------------------
RayUI:LoadEnv()
local AddOn = LibStub("AceAddon-3.0"):NewAddon(_AddOnName, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0")
local Locale = LibStub("AceLocale-3.0"):GetLocale(_AddOnName, false)
local DEFAULT_WIDTH = 850
local DEFAULT_HEIGHT = 650
AddOn.callbacks = AddOn.callbacks or LibStub("CallbackHandler-1.0"):New(AddOn)
AddOn.DF = {}
AddOn.DF["profile"] = {}
AddOn.DF["global"] = {}
AddOn.Options = {
type = "group",
name = _AddOnName,
args = {},
}
R = AddOn
L = Locale
P = AddOn.DF["profile"]
G = AddOn.DF["global"]
TEXT_LOGO_ICON = format("|T%s:14:14:0:0:64:64:0:64:0:64|t", "Interface\\AddOns\\RayUI\\media\\logo.tga")
BINDING_HEADER_RAYUI = GetAddOnMetadata(..., "Title")
function AddOn:OnProfileChanged(event, database, newProfileKey)
StaticPopup_Show("CFG_RELOAD")
end
function AddOn:PositionGameMenuButton()
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + GameMenuButtonLogout:GetHeight() - 4)
local _, relTo, _, _, offY = GameMenuButtonLogout:GetPoint()
if relTo ~= GameMenuFrame[_AddOnName] then
GameMenuFrame[_AddOnName]:ClearAllPoints()
GameMenuFrame[_AddOnName]:Point("TOPLEFT", relTo, "BOTTOMLEFT", 0, -1)
GameMenuButtonLogout:ClearAllPoints()
GameMenuButtonLogout:Point("TOPLEFT", GameMenuFrame[_AddOnName], "BOTTOMLEFT", 0, offY)
end
end
function AddOn:OnInitialize()
if not _G.RayUICharacterData then
_G.RayUICharacterData = {}
end
local configButton = CreateFrame("Button", nil, GameMenuFrame, "GameMenuButtonTemplate")
configButton:SetText(Locale["|cff7aa6d6Ray|r|cffff0000U|r|cff7aa6d6I|r设置"])
configButton:SetScript("OnClick", function()
if RayUIConfigTutorial then
RayUIConfigTutorial:Hide()
AddOn.global.Tutorial.configbutton = true
end
HideUIPanel(GameMenuFrame)
self:OpenConfig()
end)
configButton.logo = configButton:CreateTexture(nil, "OVERLAY")
configButton.logo:Size(12, 12)
configButton.logo:SetTexture("Interface\\AddOns\\RayUI\\media\\logo.tga")
configButton.logo:Point("RIGHT", configButton.Text, "LEFT", -10, 0)
GameMenuFrame[_AddOnName] = configButton
configButton:Size(GameMenuButtonLogout:GetWidth(), GameMenuButtonLogout:GetHeight())
configButton:Point("TOPLEFT", GameMenuButtonAddons, "BOTTOMLEFT", 0, -1)
hooksecurefunc("GameMenuFrame_UpdateVisibleButtons", self.PositionGameMenuButton)
self:LoadDeveloperConfig()
self.data = LibStub("AceDB-3.0"):New("RayUIData", self.DF)
self.data.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged")
self.data.RegisterCallback(self, "OnProfileCopied", "OnProfileChanged")
self.data.RegisterCallback(self, "OnProfileReset", "OnProfileChanged")
self.db = self.data.profile
self.global = self.data.global
Logger:SetLevel(self.global.general.logLevel)
self:UIScale()
self:UpdateMedia()
if self.global.general.theme == "Pixel" then
self.Border = self.mult
self.Spacing = 0
self.PixelMode = true
end
for k, v in self:IterateModules() do
v.db = AddOn.db[k]
end
self:InitializeModules()
end
local f=CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
AddOn:Initialize()
end)
function AddOn:PLAYER_REGEN_ENABLED()
AddOn:OpenConfig()
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
end
function AddOn:PLAYER_REGEN_DISABLED()
local err = false
if IsAddOnLoaded("RayUI_Options") then
local ACD = LibStub("AceConfigDialog-3.0")
if ACD.OpenFrames[_AddOnName] then
self:RegisterEvent("PLAYER_REGEN_ENABLED")
ACD:Close(_AddOnName)
err = true
end
end
for name, _ in pairs(self.CreatedMovers) do
if _G[name]:IsShown() then
err = true
_G[name]:Hide()
end
end
if err == true then
self:Print(ERR_NOT_IN_COMBAT)
self:ToggleConfigMode(true)
end
end
function AddOn:OpenConfig()
if InCombatLockdown() then
self:Print(ERR_NOT_IN_COMBAT)
self:RegisterEvent("PLAYER_REGEN_ENABLED")
return
end
if not IsAddOnLoaded("RayUI_Options") then
local _, _, _, _, reason = GetAddOnInfo("RayUI_Options")
if reason ~= "MISSING" and reason ~= "DISABLED" then
LoadAddOn("RayUI_Options")
else
self:Print("请先启用RayUI_Options插件.")
return
end
end
local ACD = LibStub("AceConfigDialog-3.0")
local mode = "Close"
if not ACD.OpenFrames[_AddOnName] then
mode = "Open"
end
ACD[mode](ACD, _AddOnName)
GameTooltip:Hide()
end
| 32.230769 | 108 | 0.638624 |
fb1282ee0bf6bb778d7df11d35367d6f19b859f4 | 1,993 | h | C | CloudTools.Vegetation/EliminateNonTrees.h | mcserep/PointCloudTools | c8cd0c5915cc3802b68164f1732f93dc11efb0d5 | [
"BSD-3-Clause"
] | 6 | 2020-12-30T03:47:43.000Z | 2022-03-01T16:24:27.000Z | CloudTools.Vegetation/EliminateNonTrees.h | mcserep/PointCloudTools | c8cd0c5915cc3802b68164f1732f93dc11efb0d5 | [
"BSD-3-Clause"
] | null | null | null | CloudTools.Vegetation/EliminateNonTrees.h | mcserep/PointCloudTools | c8cd0c5915cc3802b68164f1732f93dc11efb0d5 | [
"BSD-3-Clause"
] | 3 | 2021-03-20T14:54:25.000Z | 2022-02-23T12:55:41.000Z | #pragma once
#include <CloudTools.Common/Operation.h>
#include <CloudTools.DEM/SweepLineTransformation.hpp>
using namespace CloudTools::DEM;
namespace CloudTools
{
namespace Vegetation
{
class EliminateNonTrees : public CloudTools::DEM::SweepLineTransformation<float>
{
public:
float threshold;
/// <summary>
/// Initializes a new instance of the class. Loads input metadata and defines calculation.
/// </summary>
/// <param name="sourcePaths">The source files of the difference comparison.</param>
/// <param name="targetPath">The target file of the difference comparison.</param>
/// <param name="progress">The callback method to report progress.</param>
EliminateNonTrees(const std::vector<std::string>& sourcePaths,
const std::string& targetPath,
CloudTools::Operation::ProgressType progress = nullptr,
float threshold = 1.5)
: CloudTools::DEM::SweepLineTransformation<float>(sourcePaths, targetPath, nullptr, progress),
threshold(threshold)
{
initialize();
}
/// <summary>
/// Initializes a new instance of the class. Loads input metadata and defines calculation.
/// </summary>
/// <param name="sourceDatasets">The source datasets of the difference comparison.</param>
/// <param name="targetPath">The target file of the difference comparison.</param>
/// <param name="progress">The callback method to report progress.</param>
EliminateNonTrees(const std::vector<GDALDataset*>& sourceDatasets,
const std::string& targetPath,
CloudTools::Operation::ProgressType progress = nullptr,
float threshold = 1.5)
: CloudTools::DEM::SweepLineTransformation<float>(sourceDatasets, targetPath, 0, nullptr, progress),
threshold(threshold)
{
initialize();
}
EliminateNonTrees(const EliminateNonTrees&) = delete;
EliminateNonTrees& operator=(const EliminateNonTrees&) = delete;
private:
void initialize();
};
} // Vegetation
} // CloudTools
| 34.362069 | 102 | 0.709985 |
f4a94131b46be4185a66843287462e84f8195572 | 105 | ps1 | PowerShell | Scripts/Windows/sample-output.ps1 | chrisking81/vdc | 0ba905835742b8c29ab5b177ae2a467931e45bbf | [
"MIT"
] | 122 | 2019-02-27T00:54:08.000Z | 2021-03-23T03:00:47.000Z | Scripts/Windows/sample-output.ps1 | chrisking81/vdc | 0ba905835742b8c29ab5b177ae2a467931e45bbf | [
"MIT"
] | 63 | 2019-03-04T17:04:13.000Z | 2020-04-30T20:42:16.000Z | Scripts/Windows/sample-output.ps1 | chrisking81/vdc | 0ba905835742b8c29ab5b177ae2a467931e45bbf | [
"MIT"
] | 153 | 2019-03-04T00:34:56.000Z | 2022-01-12T15:40:02.000Z | [CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$TestString
)
Write-Host "$TestString" | 15 | 30 | 0.714286 |
70feac00b58ca86b126a1b7540f3bb0fb65fbc42 | 1,430 | cs | C# | BLL/BLLTodo.cs | batdemir/web.api.todo_dotnet.core | 0cde693e13c17bd81343151e44da237454ff783b | [
"Apache-2.0"
] | null | null | null | BLL/BLLTodo.cs | batdemir/web.api.todo_dotnet.core | 0cde693e13c17bd81343151e44da237454ff783b | [
"Apache-2.0"
] | null | null | null | BLL/BLLTodo.cs | batdemir/web.api.todo_dotnet.core | 0cde693e13c17bd81343151e44da237454ff783b | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using web.api.todo.Models.DB;
namespace web.api.todo.BLL {
public class BLLTodo {
private TODOContext context;
public BLLTodo(TODOContext context) {
this.context = context;
}
public bool CheckDataExist(Guid todoId) {
return Equals(context.Todo.Where(todo => todo.Id.Equals(todoId)).FirstOrDefault(), null);
}
public List<Todo> Get() {
return context.Todo.ToList();
}
public Todo GetById(Guid todoId) {
return context.Todo.Where(todo => todo.Id.Equals(todoId)).FirstOrDefault();
}
public Todo Insert(Todo model) {
context.Todo.Add(model);
context.SaveChanges();
return model;
}
public Todo Update(Todo model) {
var local = context.Set<Todo>().Local.FirstOrDefault(entry => entry.Id.Equals(model.Id));
if(local != null) {
context.Entry(local).State = EntityState.Detached;
}
context.Entry(model).State = EntityState.Modified;
context.SaveChanges();
return model;
}
public bool Delete(Guid todoId) {
context.Todo.Remove(GetById(todoId));
context.SaveChanges();
return false;
}
}
}
| 27.5 | 101 | 0.575524 |
967269be42b1d88b93417bb28b4c37ba5350d485 | 1,156 | php | PHP | resources/views/admin/common/sellerpaylog/index.blade.php | dabai666/o2o | 2625bfce6fa39112f00cea13d77c10984f8833a6 | [
"MIT"
] | null | null | null | resources/views/admin/common/sellerpaylog/index.blade.php | dabai666/o2o | 2625bfce6fa39112f00cea13d77c10984f8833a6 | [
"MIT"
] | null | null | null | resources/views/admin/common/sellerpaylog/index.blade.php | dabai666/o2o | 2625bfce6fa39112f00cea13d77c10984f8833a6 | [
"MIT"
] | null | null | null | @extends('admin._layouts.base')
@section('css')
<style>.spl_c_0{color:red;}.spl_c_1{color:green;}</style>
@stop
@section('right_content')
@yizan_begin
<yz:list>
<table>
<columns>
<column label="SN" align="center" width="160">
{{ $list_item['sn'] }}
</column>
<column label="商家名称" align="left">
<div>{{ $list_item['seller']['name'] }}</div>
</column>
<column label="商家手机" align="" width="150">
<div>{{ $list_item['seller']['mobile'] }}</div>
</column>
<column label="金额" align="center" width="60">
{{ $list_item['money'] }}
</column>
<column label="描述" align="left" width="150">
{{ $list_item['content'] }}
</column>
<column label="状态" align="center" width="50" css="spl_c_{{$list_item['status']}}">
{{ Lang::get('admin.sellerPayType.'.$list_item['status']) }}
</column>
<column label="创建时间" align="left" width="120">
{{ yzTime($list_item['createTime']) }}
</column>
<column label="支付时间" align="left" width="120">
{{ yzTime($list_item['payTime']) }}
</column>
</columns>
</table>
</yz:list>
@yizan_end
@stop
@section('js')
@stop
| 26.883721 | 87 | 0.57526 |
80920be187d268c90a395052f8b14b0f873fcb98 | 3,758 | java | Java | src/main/java/com/xuzp/insuredxmltool/core/tool/script/warlock/statement/ArithmeticFunction.java | xuziping/InsuredProductXmlGenerator | e94a19cf4be93ca8811cf3722ac8c16e7e135327 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/xuzp/insuredxmltool/core/tool/script/warlock/statement/ArithmeticFunction.java | xuziping/InsuredProductXmlGenerator | e94a19cf4be93ca8811cf3722ac8c16e7e135327 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/xuzp/insuredxmltool/core/tool/script/warlock/statement/ArithmeticFunction.java | xuziping/InsuredProductXmlGenerator | e94a19cf4be93ca8811cf3722ac8c16e7e135327 | [
"Apache-2.0"
] | null | null | null | package com.xuzp.insuredxmltool.core.tool.script.warlock.statement;
import com.xuzp.insuredxmltool.core.tool.formula.Factors;
import com.xuzp.insuredxmltool.core.tool.formula.Function;
import com.xuzp.insuredxmltool.core.tool.script.SyntaxException;
import com.xuzp.insuredxmltool.core.tool.script.warlock.Code;
import com.xuzp.insuredxmltool.core.tool.script.warlock.Wrap;
import com.xuzp.insuredxmltool.core.tool.script.warlock.analyse.Expression;
import com.xuzp.insuredxmltool.core.tool.script.warlock.analyse.Syntax;
import com.xuzp.insuredxmltool.core.tool.script.warlock.analyse.Words;
import com.xuzp.insuredxmltool.core.tool.script.warlock.function.*;
/**
*
* @author lerrain
*
* 2014-08-11
* 2014-08-10提到的这种形式,用?:来处理
*
* 2014-08-10
* 由逗号分割开的多个表达式,通常是用作函数或数组的参数,并不是每个都需要计算的
* 所以直接打包返回,处理的部分根据需要计算全部或者部分
* 如:x[i] = case(i>0,x[i-1]+y,y);
* 如果每个都计算,那么这个函数是没办法运行的。
*
*/
public class ArithmeticFunction implements Code
{
String name;
Code params;
Function fs;
public ArithmeticFunction(Words ws, int i)
{
if (i > 0)
throw new SyntaxException("不是一个有效的函数语法 - " + ws);
name = ws.getWord(i);
//内置函数,参数不直接运算
if ("case".equals(name))
fs = new FunctionCase();
else if ("round".equals(name))
fs = new FunctionRound();
else if ("ceil".equals(name))
fs = new FunctionCeil();
else if ("floor".equals(name))
fs = new FunctionFloor();
else if ("format".equals(name))
fs = new FunctionFormat();
else if ("array".equals(name))
fs = new FunctionArray();
else if ("min".equals(name))
fs = new FunctionMin();
else if ("max".equals(name))
fs = new FunctionMax();
else if ("pow".equals(name))
fs = new FunctionPow();
else if ("size".equals(name))
fs = new FunctionSize();
else if ("trim".equals(name))
fs = new FunctionTrim();
else if ("empty".equals(name))
fs = new FunctionEmpty();
else if ("str_begin".equals(name))
fs = new FunctionStrBegin();
else if ("str_end".equals(name))
fs = new FunctionStrEnd();
else if ("str_index".equals(name))
fs = new FunctionStrIndex();
else if ("call".equals(name))
fs = new FunctionCall();
else if ("print".equals(name))
fs = new FunctionPrint();
else if ("fill".equals(name))
fs = new FunctionFill();
else if ("sum".equals(name))
fs = new FunctionSum();
else if ("val".equals(name))
fs = new FunctionVal();
else if ("find".equals(name))
fs = new FunctionFind();
else if ("str".equals(name))
fs = new FunctionStr();
else if ("str_split".equals(name))
fs = new FunctionStrSplit();
else if ("random".equals(name))
fs = new FunctionRandom();
int l = i + 1;
int r = Syntax.findRightBrace(ws, l + 1);
params = l + 1 == r ? null : Expression.expressionOf(ws.cut(l + 1, r));
}
public Object run(Factors factors)
{
if ("try".equals(name))
{
ArithmeticComma c = (ArithmeticComma)params;
try
{
return c.left().run(factors);
}
catch (Exception e)
{
return c.right().run(factors);
}
}
Function f = fs;
Object v = factors.get(name);
if (v != null && v instanceof Function)
f = (Function)v;
if (f == null)
{
if (v == null)
throw new RuntimeException("未找到函数 - " + name);
else
throw new RuntimeException("该变量对应的值不是函数体 - " + name + " is " + v.getClass());
}
//用户自定义的函数,参数直接运算
Object[] wrap = Wrap.arrayOf(params, factors);
// Stack stack = new Stack(factors);
// if (wrap != null)
// {
// stack.set("#0", new Integer(wrap.length));
// for (int i = 0; i < wrap.length; i++)
// {
// stack.set("#" + (i + 1), wrap[i]);
// }
// }
return f.run(wrap, factors);
}
public String toText(String space)
{
return name + "(" + (params == null ? "" : params.toText("")) + ")";
}
}
| 25.391892 | 81 | 0.642629 |
53c70d5216316d2aa788b5659a3149d8865bf235 | 385 | java | Java | spi/src/main/java/org/femtoframework/service/Filter.java | femtoframework/femto-service | 5f2cf85349430eec1bda94b85e98bbcdd55ef019 | [
"Apache-2.0"
] | 1 | 2019-05-05T06:20:52.000Z | 2019-05-05T06:20:52.000Z | spi/src/main/java/org/femtoframework/service/Filter.java | femtoframework/femto-service | 5f2cf85349430eec1bda94b85e98bbcdd55ef019 | [
"Apache-2.0"
] | 4 | 2019-11-19T17:00:04.000Z | 2019-11-21T17:35:17.000Z | spi/src/main/java/org/femtoframework/service/Filter.java | femtoframework/femto-service | 5f2cf85349430eec1bda94b85e98bbcdd55ef019 | [
"Apache-2.0"
] | null | null | null | package org.femtoframework.service;
/**
* 请求和响应过滤器
*
* @author fengyun
* @version 1.00 2005-5-4 23:38:44
*/
public interface Filter
{
/**
* 执行命令
*
* @param request 请求
* @param response 响应
* @param chain 过滤器链
* @throws Exception 如果没法被过滤器接受时抛出
*/
void filter(Request request, Response response, FilterChain chain) throws Exception;
}
| 18.333333 | 88 | 0.625974 |
f477fcd1a00a13108d035ddd0968602b99009092 | 191 | kt | Kotlin | app/src/main/java/com/flimbis/tvmaze/util/MazeAppSupport.kt | isnirp/TvSerial | 74181ea1621e094cf5a95401ee3d334b2f9c1d4c | [
"Apache-2.0"
] | 2 | 2017-05-19T14:05:37.000Z | 2017-05-19T14:12:37.000Z | app/src/main/java/com/flimbis/tvmaze/util/MazeAppSupport.kt | isnirp/TvSerial | 74181ea1621e094cf5a95401ee3d334b2f9c1d4c | [
"Apache-2.0"
] | 3 | 2017-05-22T05:03:25.000Z | 2019-07-01T01:34:37.000Z | app/src/main/java/com/flimbis/tvmaze/util/MazeAppSupport.kt | isnirp/TvSerial | 74181ea1621e094cf5a95401ee3d334b2f9c1d4c | [
"Apache-2.0"
] | 1 | 2017-05-19T14:31:08.000Z | 2017-05-19T14:31:08.000Z | package com.flimbis.tvmaze.util
import android.os.Build
inline fun supportsLollipop(code: ()-> Unit){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
code()
}
} | 21.222222 | 64 | 0.685864 |
e8787be28d23f08d8c7f93167a8f59c882707dff | 4,806 | hpp | C++ | include/collision_constraints.hpp | dabinkim-LGOM/lsc_planner | 88dcb1de59bac810d1b1fd194fe2b8d24d1860c9 | [
"MIT"
] | 9 | 2021-09-04T15:14:57.000Z | 2022-03-29T04:34:13.000Z | include/collision_constraints.hpp | dabinkim-LGOM/lsc_planner | 88dcb1de59bac810d1b1fd194fe2b8d24d1860c9 | [
"MIT"
] | null | null | null | include/collision_constraints.hpp | dabinkim-LGOM/lsc_planner | 88dcb1de59bac810d1b1fd194fe2b8d24d1860c9 | [
"MIT"
] | 4 | 2021-09-29T11:32:54.000Z | 2022-03-06T05:24:33.000Z | #ifndef LSC_PLANNER_COLLISION_CONSTRAINTS_HPP
#define LSC_PLANNER_COLLISION_CONSTRAINTS_HPP
#include <vector>
#include <octomap/octomap_types.h>
#include <visualization_msgs/MarkerArray.h>
#include <dynamic_msgs/CollisionConstraint.h>
#include <sp_const.hpp>
#include <param.hpp>
#include <util.hpp>
#include <geometry.hpp>
#include <utility>
namespace DynamicPlanning {
// Linear Safe Corridor
// LSC = {c \in R^3 | (c - c_obs).dot(normal_vector) - d > 0}
class LSC{
public:
LSC() = default;
LSC(const octomap::point3d& obs_control_point,
const octomap::point3d& normal_vector,
double d);
visualization_msgs::Marker convertToMarker(double agent_radius) const;
octomap::point3d obs_control_point;
octomap::point3d normal_vector;
double d = 0;
};
typedef std::vector<LSC> LSCs;
class Box{
public:
Box() = default;
Box(const octomap::point3d& box_min, const octomap::point3d& box_max);
LSCs convertToLSCs(int dim) const;
visualization_msgs::Marker convertToMarker(double agent_radius) const;
bool isPointInBox(const octomap::point3d& point) const;
bool isPointsInTwoBox(const std::vector<octomap::point3d>& points, const Box& other_sfc) const;
bool isSuperSetOfConvexHull(const std::vector<octomap::point3d>& convex_hull) const;
bool isLineOnBoundary(const Line& line) const;
bool intersectWith(const Box& other_sfc) const;
Box unify(const Box& other_sfc) const;
Box intersection(const Box& other_sfc) const;
std::vector<octomap::point3d> getVertices() const;
lines_t getEdges() const;
octomap::point3d getBoxMin() const;
octomap::point3d getBoxMax() const;
private:
octomap::point3d box_min;
octomap::point3d box_max;
};
class SFC{
public:
Box box;
LSCs lscs;
Box inter_box; // visualization purpose
int box_library_idx1, box_library_idx2; // debugging purpose
LSCs convertToLSCs(int dim) const;
bool update(const Box& box); //return whether success
bool update(const std::vector<octomap::point3d>& convex_hull, const Box& box1, const Box& box2); //return whether success
bool update(const std::vector<octomap::point3d>& convex_hull, const Box& box1, const Box& box2, double& dist_to_convex_hull); //return whether success
};
typedef std::vector<std::vector<std::vector<LSC>>> RSFCs; // [obs_idx][segment_idx][control_point_idx]
typedef std::vector<SFC> SFCs; // [segment_idx]
typedef std::vector<Box> Boxes;
class CollisionConstraints {
public:
CollisionConstraints() = default;
void initialize(int N_obs, int M, int n, double dt, std::set<int> obs_slack_indices);
LSC getLSC(int oi, int m, int i) const;
SFC getSFC(int m) const;
size_t getObsSize() const;
std::set<int> getSlackIndices() const;
void setLSC(int oi, int m,
const std::vector<octomap::point3d>& obs_control_points,
const octomap::point3d& normal_vector,
const std::vector<double>& ds);
void setLSC(int oi, int m,
const std::vector<octomap::point3d>& obs_control_points,
const octomap::point3d& normal_vector,
double d);
void setSFC(int m, const SFC& sfc);
void setSFC(int m, const Box& box);
visualization_msgs::MarkerArray convertToMarkerArrayMsg(const std::vector<dynamic_msgs::Obstacle>& obstacles,
const std::vector<std_msgs::ColorRGBA>& colors,
int agent_id, double agent_radius) const;
dynamic_msgs::CollisionConstraint convertToRawMsg(const std::vector<dynamic_msgs::Obstacle>& obstacles,
int planner_seq) const;
private:
RSFCs lscs;
SFCs sfcs;
std::set<int> obs_slack_indices;
Boxes box_library;
int N_obs, M, n;
double dt;
void setProperSFC(int m, const std::vector<octomap::point3d>& convex_hull);
visualization_msgs::MarkerArray convertLSCsToMarkerArrayMsg(
const std::vector<dynamic_msgs::Obstacle>& obstacles,
const std::vector<std_msgs::ColorRGBA>& colors,
double agent_radius) const;
visualization_msgs::MarkerArray convertSFCsToMarkerArrayMsg(const std_msgs::ColorRGBA& color,
double agent_radius) const;
};
}
#endif //LSC_PLANNER_COLLISION_CONSTRAINTS_HPP
| 37.546875 | 158 | 0.627757 |
6c3be42a06999b85a490e482367e8077ed6fddb4 | 4,523 | ps1 | PowerShell | internal/functions/Compare-DbaCollationSensitiveObject.ps1 | frke/dbatools | d6714431aa48afc856e483249377f7d44c6980fa | [
"MIT"
] | 69 | 2022-01-13T18:59:48.000Z | 2022-03-31T22:06:22.000Z | internal/functions/Compare-DbaCollationSensitiveObject.ps1 | frke/dbatools | d6714431aa48afc856e483249377f7d44c6980fa | [
"MIT"
] | 204 | 2022-01-13T13:44:57.000Z | 2022-03-31T22:21:48.000Z | internal/functions/Compare-DbaCollationSensitiveObject.ps1 | frke/dbatools | d6714431aa48afc856e483249377f7d44c6980fa | [
"MIT"
] | 28 | 2022-01-13T18:13:04.000Z | 2022-03-30T09:37:25.000Z | <#
.SYNOPSIS
Filters InputObject, Compares a property to value(s) using a given sql server collation
.DESCRIPTION
The Compare-DbaCollationSensitiveObject command filters an Inputobject using a string comparer builder provided by the SMO, for a given sql server collation.
.PARAMETER InputObject
The Object to Filter
.PARAMETER Property
Name of the Property of InputObject to compare
.PARAMETER Value
Object that Property is compared against
.PARAMETER In
Members of InputObject where the value of the Property is within the Value set are returned
.PARAMETER NotIn
Members of InputObject where the value of the Property is not within the Value set are returned
.PARAMETER Eq
Members of InputObject where the value of the Property is equivalent to the Value
.PARAMETER Ne
Members of InputObject where the value of the Property is not not equivalent to the Value
.PARAMETER Collation
Name of the collation to use for comparison
.NOTES
Tags: Database
Author: Charles Hightower
Website: https://dbatools.io
Copyright: (c) 2021 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
.EXAMPLE
PS C:\> $server = Connect-DbaInstance -SqlInstance localhost
PS C:\> $lastCopyOnlyBackups = Get-DbaDbBackupHistory -SqlInstance $server -LastFull -IncludeCopyOnly | Where-Object IsCopyOnly
PS C:\> $server.Databases | Compare-DbaCollationSensitiveObject -Property Name -In -Value $lastCopyOnlyBackups.Database -Collation $server.Collation
Returns all databases on the local default SQL Server instance with copy only backups using the collation of the SqlInstance
.EXAMPLE
PS C:\> $server = Connect-DbaInstance -SqlInstance localhost
PS C:\> $lastFullBackups = Get-DbaDbBackupHistory -SqlInstance $server -LastFull
PS C:\> $server.Databases | Compare-DbaCollationSensitiveObject -Property Name -NotIn -Value $lastFullBackups.Database -Collation $server.Collation
Returns only the databases on the local default SQL Server instance without a Full Backup, using the collation of the SqlInstance
#>
Function Compare-DbaCollationSensitiveObject {
[CmdletBinding()]
param(
[parameter(Mandatory, ValueFromPipeline = $true)]
[psObject]$InputObject,
[parameter(Mandatory)]
[string]$Property,
[parameter(Mandatory, ParameterSetName = 'In')]
[switch]$In,
[parameter(Mandatory, ParameterSetName = 'NotIn')]
[switch]$NotIn,
[parameter(Mandatory, ParameterSetName = 'Eq')]
[switch]$Eq,
[parameter(Mandatory, ParameterSetName = 'Ne')]
[switch]$Ne,
[object]$Value,
[parameter(Mandatory)]
[String]$Collation)
begin {
#If InputObject is passed in by name, change it to a pipeline, so we can use the process block
if ($PSBoundParameters['InputObject']) {
$newParamaters = $PSBoundParameters
$null = $newParamaters.Remove('InputObject')
return $InputObject | Compare-DbaCollationSensitiveObject @newParamaters
}
$stringComparer = (New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server).getStringComparer($Collation)
}
process {
$obj = $_
if (-not $obj) { return }
switch ($PsCmdlet.ParameterSetName) {
"In" {
foreach ($dif in $Value) {
if ($stringComparer.Compare($obj.$Property, $dif) -eq 0) {
return $obj
}
}
break
}
"NotIn" {
$matchFound = $false
foreach ($dif in $Value) {
if ($stringComparer.Compare($obj.$Property, $dif) -eq 0) {
$matchFound = $true
}
}
if (-not $matchFound) {
return $obj
}
break
}
"Eq" {
if ($stringComparer.Compare($obj.Property, $Value) -eq 0) {
return $obj
}
break
}
"Ne" {
if ($stringComparer.Compare($obj.$Property, $Value) -ne 0) {
return $obj
}
break
}
}
}
end { }
} | 37.380165 | 165 | 0.59916 |
861799d5d6a64fe971a5d47f2e612da1bb0ffbdd | 1,860 | java | Java | discovery-prep-spark-engine/src/main/java/app/metatron/discovery/prep/spark/rule/PrepHeader.java | joohokim1/discovery-spark-server | 1e9289432736efbb14b0ef320da13ac763efefa8 | [
"Apache-2.0"
] | 9 | 2019-08-19T07:53:27.000Z | 2021-03-30T06:27:31.000Z | discovery-prep-spark-engine/src/main/java/app/metatron/discovery/prep/spark/rule/PrepHeader.java | joohokim1/discovery-spark-server | 1e9289432736efbb14b0ef320da13ac763efefa8 | [
"Apache-2.0"
] | 3 | 2019-11-14T13:18:05.000Z | 2020-03-04T23:03:51.000Z | discovery-prep-spark-engine/src/main/java/app/metatron/discovery/prep/spark/rule/PrepHeader.java | joohokim1/discovery-spark-server | 1e9289432736efbb14b0ef320da13ac763efefa8 | [
"Apache-2.0"
] | 3 | 2019-11-01T06:20:22.000Z | 2021-03-30T06:49:30.000Z | /*
* 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 app.metatron.discovery.prep.spark.rule;
import static app.metatron.discovery.prep.spark.util.StringUtil.makeParsable;
import static app.metatron.discovery.prep.spark.util.StringUtil.modifyDuplicatedColName;
import app.metatron.discovery.prep.parser.preparation.rule.Header;
import app.metatron.discovery.prep.parser.preparation.rule.Rule;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
public class PrepHeader extends PrepRule {
public static Dataset<Row> transform(Dataset<Row> df, Rule rule) {
Dataset<Row> newDf = df;
String newColName;
Header header = (Header) rule;
Integer rownum = header.getRownum();
if (rownum == null) {
rownum = 1;
}
newDf = newDf.withColumn("rowid", org.apache.spark.sql.functions.monotonically_increasing_id());
String[] colNames = df.columns();
Row row = newDf.filter("rowid = " + (rownum - 1)).head();
newDf = newDf.filter("rowid != " + (rownum - 1));
for (int i = 0; i < colNames.length; i++) {
if (row.get(i) != null) {
newColName = row.get(i).toString();
} else {
newColName = "column" + (i + 1);
}
newDf = newDf.withColumnRenamed(colNames[i], modifyDuplicatedColName(df, makeParsable(newColName)));
}
return newDf;
}
}
| 33.818182 | 106 | 0.697849 |
9c5b63ea0bcb294499b070e4be28988cab9cbe03 | 9,033 | cpp | C++ | libs/random/test/random_test.cpp | zyiacas/boost-doc-zh | 689e5a3a0a4dbead1a960f7b039e3decda54aa2c | [
"BSL-1.0"
] | 11 | 2015-07-12T13:04:52.000Z | 2021-05-30T23:23:46.000Z | libs/random/test/random_test.cpp | sdfict/boost-doc-zh | 689e5a3a0a4dbead1a960f7b039e3decda54aa2c | [
"BSL-1.0"
] | null | null | null | libs/random/test/random_test.cpp | sdfict/boost-doc-zh | 689e5a3a0a4dbead1a960f7b039e3decda54aa2c | [
"BSL-1.0"
] | 3 | 2015-12-23T01:51:57.000Z | 2019-08-25T04:58:32.000Z | /* boost random_test.cpp various tests
*
* Copyright Jens Maurer 2000
* Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* $Id: random_test.cpp 60755 2010-03-22 00:45:06Z steven_watanabe $
*/
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
#pragma warning( disable : 4786 )
#endif
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <iterator>
#include <vector>
#include <boost/random.hpp>
#include <boost/config.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::abs; using ::fabs; using ::pow; }
#endif
/*
* General portability note:
* MSVC mis-compiles explicit function template instantiations.
* For example, f<A>() and f<B>() are both compiled to call f<A>().
* BCC is unable to implicitly convert a "const char *" to a std::string
* when using explicit function template instantiations.
*
* Therefore, avoid explicit function template instantiations.
*/
/*
* A few equidistribution tests
*/
// yet to come...
template<class Generator>
void check_uniform_int(Generator & gen, int iter)
{
std::cout << "testing uniform_int(" << (gen.min)() << "," << (gen.max)()
<< ")" << std::endl;
int range = (gen.max)()-(gen.min)()+1;
std::vector<int> bucket(range);
for(int j = 0; j < iter; j++) {
int result = gen();
if(result < (gen.min)() || result > (gen.max)())
std::cerr << " ... delivers " << result << std::endl;
else
bucket[result-(gen.min)()]++;
}
int sum = 0;
// use a different variable name "k", because MSVC has broken "for" scoping
for(int k = 0; k < range; k++)
sum += bucket[k];
double avg = static_cast<double>(sum)/range;
double p = 1 / static_cast<double>(range);
double threshold = 2*std::sqrt(static_cast<double>(iter)*p*(1-p));
for(int i = 0; i < range; i++) {
if(std::fabs(bucket[i] - avg) > threshold) {
// 95% confidence interval
std::cout << " ... has bucket[" << i << "] = " << bucket[i]
<< " (distance " << (bucket[i] - avg) << ")"
<< std::endl;
}
}
}
template<class Generator>
void test_uniform_int(Generator & gen)
{
typedef boost::uniform_int<int> int_gen;
// large range => small range (modulo case)
typedef boost::variate_generator<Generator&, int_gen> level_one;
level_one uint12(gen, int_gen(1,2));
BOOST_CHECK((uint12.distribution().min)() == 1);
BOOST_CHECK((uint12.distribution().max)() == 2);
check_uniform_int(uint12, 100000);
level_one uint16(gen, int_gen(1,6));
check_uniform_int(uint16, 100000);
// test chaining to get all cases in operator()
// identity map
typedef boost::variate_generator<level_one&, int_gen> level_two;
level_two uint01(uint12, int_gen(0, 1));
check_uniform_int(uint01, 100000);
// small range => larger range
level_two uint05(uint12, int_gen(-3, 2));
check_uniform_int(uint05, 100000);
// small range => larger range
level_two uint099(uint12, int_gen(0, 99));
check_uniform_int(uint099, 100000);
// larger => small range, rejection case
typedef boost::variate_generator<level_two&, int_gen> level_three;
level_three uint1_4(uint05, int_gen(1, 4));
check_uniform_int(uint1_4, 100000);
typedef boost::uniform_int<boost::uint8_t> int8_gen;
typedef boost::variate_generator<Generator&, int8_gen> gen8_t;
gen8_t gen8_03(gen, int8_gen(0, 3));
// use the full range of the type, where the destination
// range is a power of the source range
typedef boost::variate_generator<gen8_t, int8_gen> uniform_uint8;
uniform_uint8 uint8_0255(gen8_03, int8_gen(0, 255));
check_uniform_int(uint8_0255, 100000);
// use the full range, but a generator whose range is not
// a root of the destination range.
gen8_t gen8_02(gen, int8_gen(0, 2));
uniform_uint8 uint8_0255_2(gen8_02, int8_gen(0, 255));
check_uniform_int(uint8_0255_2, 100000);
// expand the range to a larger type.
typedef boost::variate_generator<gen8_t, int_gen> uniform_uint_from8;
uniform_uint_from8 uint0300(gen8_03, int_gen(0, 300));
check_uniform_int(uint0300, 100000);
}
#if defined(BOOST_MSVC) && _MSC_VER < 1300
// These explicit instantiations are necessary, otherwise MSVC does
// not find the <boost/operators.hpp> inline friends.
// We ease the typing with a suitable preprocessor macro.
#define INSTANT(x) \
template class boost::uniform_smallint<x>; \
template class boost::uniform_int<x>; \
template class boost::uniform_real<x>; \
template class boost::bernoulli_distribution<x>; \
template class boost::geometric_distribution<x>; \
template class boost::triangle_distribution<x>; \
template class boost::exponential_distribution<x>; \
template class boost::normal_distribution<x>; \
template class boost::uniform_on_sphere<x>; \
template class boost::lognormal_distribution<x>;
INSTANT(boost::minstd_rand0)
INSTANT(boost::minstd_rand)
INSTANT(boost::ecuyer1988)
INSTANT(boost::kreutzer1986)
INSTANT(boost::hellekalek1995)
INSTANT(boost::mt19937)
INSTANT(boost::mt11213b)
#undef INSTANT
#endif
#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
// testcase by Mario Rutti
class ruetti_gen
{
public:
ruetti_gen() : state((max)() - 1) {}
typedef boost::uint64_t result_type;
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return std::numeric_limits<result_type>::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
result_type operator()() { return state--; }
private:
result_type state;
};
void test_overflow_range()
{
ruetti_gen gen;
boost::variate_generator<ruetti_gen, boost::uniform_int<> >
rng(gen, boost::uniform_int<>(0, 10));
for (int i=0;i<10;i++)
(void) rng();
}
#else
void test_overflow_range()
{ }
#endif
template <typename EngineT>
struct rand_for_random_shuffle
{
explicit rand_for_random_shuffle(EngineT &engine)
: m_engine(engine)
{ }
template <typename IntT>
IntT operator()(IntT upperBound)
{
assert(upperBound > 0);
if (upperBound == 1)
{
return 0;
}
typedef boost::uniform_int<IntT> distribution_type;
typedef boost::variate_generator<EngineT &, distribution_type> generator_type;
return generator_type(m_engine, distribution_type(0, upperBound - 1))();
}
EngineT &m_engine;
};
// Test that uniform_int<> can be used with std::random_shuffle
// Author: Jos Hickson
void test_random_shuffle()
{
typedef boost::uniform_int<> distribution_type;
typedef boost::variate_generator<boost::mt19937 &, distribution_type> generator_type;
boost::mt19937 engine1(1234);
boost::mt19937 engine2(1234);
rand_for_random_shuffle<boost::mt19937> referenceRand(engine1);
distribution_type dist(0,10);
generator_type testRand(engine2, dist);
std::vector<int> referenceVec;
for (int i = 0; i < 200; ++i)
{
referenceVec.push_back(i);
}
std::vector<int> testVec(referenceVec);
std::random_shuffle(referenceVec.begin(), referenceVec.end(), referenceRand);
std::random_shuffle(testVec.begin(), testVec.end(), testRand);
typedef std::vector<int>::iterator iter_type;
iter_type theEnd(referenceVec.end());
for (iter_type referenceIter(referenceVec.begin()), testIter(testVec.begin());
referenceIter != theEnd;
++referenceIter, ++testIter)
{
BOOST_CHECK_EQUAL(*referenceIter, *testIter);
}
}
int test_main(int, char*[])
{
#if !defined(__INTEL_COMPILER) || !defined(_MSC_VER) || __INTEL_COMPILER > 700
boost::mt19937 mt;
test_uniform_int(mt);
// bug report from Ken Mahler: This used to lead to an endless loop.
typedef boost::uniform_int<unsigned int> uint_dist;
boost::minstd_rand mr;
boost::variate_generator<boost::minstd_rand, uint_dist> r2(mr,
uint_dist(0, 0xffffffff));
r2();
r2();
// bug report from Fernando Cacciola: This used to lead to an endless loop.
// also from Douglas Gregor
boost::variate_generator<boost::minstd_rand, boost::uniform_int<> > x(mr, boost::uniform_int<>(0, 8361));
(void) x();
// bug report from Alan Stokes and others: this throws an assertion
boost::variate_generator<boost::minstd_rand, boost::uniform_int<> > y(mr, boost::uniform_int<>(1,1));
std::cout << "uniform_int(1,1) " << y() << ", " << y() << ", " << y()
<< std::endl;
test_overflow_range();
test_random_shuffle();
return 0;
#else
std::cout << "Intel 7.00 on Win32 loops, so the test is disabled\n";
return 1;
#endif
}
| 30.934932 | 146 | 0.667995 |
7909264c496eab6f82eee4d4e3a253ec8f0966e0 | 303 | dart | Dart | lib/app.dart | Nobi1202/Flutter-Trainning | 6975a2ada7213809df173e668ed79d806a96a64f | [
"Apache-2.0"
] | 1 | 2021-11-15T07:21:47.000Z | 2021-11-15T07:21:47.000Z | lib/app.dart | Nobi1202/Flutter-Trainning | 6975a2ada7213809df173e668ed79d806a96a64f | [
"Apache-2.0"
] | null | null | null | lib/app.dart | Nobi1202/Flutter-Trainning | 6975a2ada7213809df173e668ed79d806a96a64f | [
"Apache-2.0"
] | null | null | null | import 'package:fl_training/ui/dashboard/dashboard.dart';
import 'package:flutter/material.dart';
class GreenifyApp extends StatelessWidget {
const GreenifyApp({Key? key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: DashboardScreen(),
);
}
}
| 20.2 | 57 | 0.722772 |
5b36101a2d271b4584d3b3510023fe94e9aa35f3 | 370 | h | C | slope.h | haranjackson/Euler1D | 64012813c4f9d50f1501ad06ff02b70d14309967 | [
"MIT"
] | 3 | 2019-10-02T20:21:43.000Z | 2021-11-09T09:59:35.000Z | slope.h | haranjackson/Euler1D | 64012813c4f9d50f1501ad06ff02b70d14309967 | [
"MIT"
] | null | null | null | slope.h | haranjackson/Euler1D | 64012813c4f9d50f1501ad06ff02b70d14309967 | [
"MIT"
] | 2 | 2019-06-18T17:06:00.000Z | 2020-02-16T20:28:43.000Z | #ifndef __SLOPE__
#define __SLOPE__
#include <vector>
#include "variables.h"
double xiR(double r, double w);
double xiSB(double r, double w);
double xiVL(double r, double w);
double xiVA(double r, double w);
double xiMB(double r, double w);
double xi(double r, double w, int l);
std::vector<double> slope(state CL, state C, state CR, double w, int l);
#endif | 15.416667 | 72 | 0.705405 |
ec3f909d99bda2e0c0ba3c50d08346686d99bb3c | 6,547 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_815.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_815.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_815.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 %r13
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x12169, %rbp
nop
nop
nop
cmp $46189, %rdi
movb (%rbp), %r8b
nop
nop
sub %rsi, %rsi
lea addresses_A_ht+0x1d669, %rsi
lea addresses_UC_ht+0x3669, %rdi
nop
nop
nop
nop
cmp %r13, %r13
mov $109, %rcx
rep movsq
nop
nop
nop
nop
cmp %r8, %r8
lea addresses_D_ht+0x11da5, %rsi
nop
nop
nop
nop
nop
dec %r14
mov (%rsi), %r13w
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x1e67f, %rbp
nop
nop
add %rcx, %rcx
mov (%rbp), %rdi
nop
nop
nop
nop
inc %rdi
lea addresses_WC_ht+0x6469, %rdi
nop
nop
nop
nop
nop
cmp %rsi, %rsi
movw $0x6162, (%rdi)
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_normal_ht+0x30a9, %rsi
lea addresses_UC_ht+0x6ea9, %rdi
nop
nop
nop
xor $14361, %rdx
mov $7, %rcx
rep movsl
nop
nop
nop
nop
nop
and $60561, %r13
lea addresses_WC_ht+0x8dbd, %rcx
clflush (%rcx)
inc %rbp
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
and $0xffffffffffffffc0, %rcx
movaps %xmm1, (%rcx)
nop
nop
nop
nop
add $63347, %rdx
lea addresses_normal_ht+0xae69, %rbp
nop
nop
nop
nop
sub %r8, %r8
mov (%rbp), %dx
nop
nop
nop
nop
nop
and $59092, %rsi
lea addresses_D_ht+0x9469, %rsi
nop
nop
nop
xor %r14, %r14
movb $0x61, (%rsi)
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_WT_ht+0x12e69, %rsi
lea addresses_UC_ht+0x15ea1, %rdi
nop
nop
nop
nop
nop
add $9868, %r8
mov $123, %rcx
rep movsq
inc %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rdx
push %rsi
// Faulty Load
lea addresses_PSE+0xd669, %rdx
nop
nop
nop
add $9983, %r13
vmovups (%rdx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r12
lea oracles, %r13
and $0xff, %r12
shlq $12, %r12
mov (%r13,%r12,1), %r12
pop %rsi
pop %rdx
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 33.92228 | 2,999 | 0.660302 |
53dba5731625b2779890cd99ede1cfe16fdc6cb6 | 95 | lua | Lua | fxmanifest.lua | yusuf412/yb-lisans | 87e8b5b3adbde04367022a96123193d9424cc218 | [
"Apache-2.0"
] | null | null | null | fxmanifest.lua | yusuf412/yb-lisans | 87e8b5b3adbde04367022a96123193d9424cc218 | [
"Apache-2.0"
] | null | null | null | fxmanifest.lua | yusuf412/yb-lisans | 87e8b5b3adbde04367022a96123193d9424cc218 | [
"Apache-2.0"
] | null | null | null | fx_version "adamant" -- abdest
author "yusufemreb"
game "gta5"
server_script "license.lua" | 19 | 31 | 0.736842 |
2bee510a595427e67b2152435b7926f2c3cd5ea6 | 10,149 | swift | Swift | ProyectoEnergias/ProyectoEnergias/RegionConsumptionViewController.swift | AliVillegas/Ecobook | 25bc31adab88900c2b22d44782a8af51a0946960 | [
"MIT"
] | null | null | null | ProyectoEnergias/ProyectoEnergias/RegionConsumptionViewController.swift | AliVillegas/Ecobook | 25bc31adab88900c2b22d44782a8af51a0946960 | [
"MIT"
] | null | null | null | ProyectoEnergias/ProyectoEnergias/RegionConsumptionViewController.swift | AliVillegas/Ecobook | 25bc31adab88900c2b22d44782a8af51a0946960 | [
"MIT"
] | null | null | null | //
// RegionConsumptionViewController.swift
// EcoBook
//
// Created by Ali Bryan Villegas Zavala on 4/8/19.
// Copyright © 2019 Tec de Monterrey. All rights reserved.
//
import UIKit
import Charts
import FirebaseAuth
import Firebase
class RegionConsumptionViewController: UIViewController {
let defaults = UserDefaults.standard
var dataObj: [Any]?
var averageCost = 0.0
var dataStringURL = "http://martinmolina.com.mx/201911/data/ProyectoEnergiasRenovables/graphRegions.json"
var estados = ["", " Aguascalientes", " Baja California ", " Baja California Sur ", "Campeche", "Chiapas", "Chihuahua", "Coahuila", "Colima", "Ciudad de México", "Durango", "Estado de México", "Guanajuato", "Guerrero" , "Hidalgo", "Jalisco", "Michoacán", "Morelos", "Nayarit", "Nuevo León", "Oaxaca", "Puebla", "Querétaro", "Quintana Roo", "San Luis Potosí", "Sinaloa", "Sonora", "Tabasco", "Tamaulipas", "Tlaxcala", "Veracruz", "Yucatán", "Zacatecas" , ""]
var consumptionByMonth:[Double] = [0, 252, 377,1100, 249, 237, 375, 317, 252, 270, 258, 261, 254,210, 195, 262, 242, 325, 207, 277, 190, 228, 260,350, 248, 435, 498, 291, 523, 232, 212, 329,340,214,0]
private let locationManager = LocationManager()
@IBOutlet weak var lineChartView: LineChartView!
override func viewDidLoad() {
super.viewDidLoad()
var costoTotal = 0.0
var receiptCounter = 0.0
var userDataReceipts = [[String : String]]()
//DOWLOAD FROM JSON HAPPENS HERE
var dataURL = URL(string:dataStringURL)
let data = try? Data(contentsOf: dataURL!)
dataObj = try!JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as? [AnyObject]
print("DATAOBJ\(dataObj)")
var mapDictionary = dataObj?[0] as! [String:Any]
print("MAP\(mapDictionary)")
estados = mapDictionary["estados"] as! [String]
var consumptionPerMonth = mapDictionary["consumptionByMonth"] as! [Double]
consumptionByMonth = consumptionPerMonth
//estados = dataObj![1] as! [String]
var ref:DatabaseReference = Database.database().reference()
var recibos:NSArray?
self.showSpinner(onView: view)
ref.child("usuarios").child(Auth.auth().currentUser!.uid).observeSingleEvent(of: .value, with: { (snapshot) in
// Get user value
let value = snapshot.value as? NSDictionary
print("FOUNDVALUE")
if value != nil{
recibos = (value?["Recibos"] as? NSArray)!
print("FOUNDVALUEARRAY")
if recibos != nil {
print(recibos)
}
}
self.removeSpinner()
userDataReceipts = recibos as! [[String : String]]
print("reCEIVED DATA FROM FIREBASE")
//print(recibos)
if (recibos != nil ){
var userDataReceiptsMine = [[String:String]]()
userDataReceipts = recibos as! [[String : String]]
}
for receipt in userDataReceipts{
var costoString = receipt["CostoTotal"] as! String
var costoDouble = Double(costoString) ?? -10
if(costoDouble != -10 || costoDouble != 0) {
costoTotal += costoDouble
receiptCounter = receiptCounter + 1.0
}
}
print("AAVERAGE")
self.averageCost = costoTotal/receiptCounter
print(self.averageCost)
self.view.layoutIfNeeded()
let alert = UIAlertController(title: "Importante", message: "Los datos presentados a continuación están basados en la información más reciente publicada por la CFE sobre el consumo promedio por estado", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Continuar", style: .default, handler: nil))
//self.present(alert, animated: true)
self.setChart(dataPoints: self.estados, values: self.consumptionByMonth)
// Do any additional setup after loading the view.
self.removeSpinner()
// ...
}) { (error) in
let alert = UIAlertController(title: "alerta", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: nil))
self.present(alert, animated: true)
print("ERRORFOUND")
print(error.localizedDescription)
self.removeSpinner()
}
}
func setChart(dataPoints: [String], values: [Double]) {
let formato:LineChartFilledFormatter = LineChartFilledFormatter()
let xaxis:XAxis = XAxis()
lineChartView.noDataText = "Aún no tienes suficientes recibos para generar estadísticas"
var dataEntries: [ChartDataEntry] = []
var counter = 0
for i in 0..<dataPoints.count {
let dataEntry = ChartDataEntry(x: Double(i), y:values[i])
dataEntries.append(dataEntry)
counter = counter + 1
formato.stringForValue(Double(i), axis: xaxis)
xaxis.valueFormatter = formato
}
lineChartView.xAxis.valueFormatter = xaxis.valueFormatter
let chartDataSet = LineChartDataSet(values: dataEntries, label: "Consumo promedio de usuario ($ - Bimestral)")
let chartData = LineChartData()
lineChartView.rightAxis.enabled = false
lineChartView.xAxis.drawGridLinesEnabled = false
//barChartView.leftAxis.drawGridLinesEnabled = false
chartDataSet.lineWidth = 4.0
chartDataSet.colors = [UIColor(red: 24/255, green: 30/255, blue: 150/255, alpha: 1)]
chartDataSet.circleHoleColor = UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 0)
chartDataSet.drawFilledEnabled = true
chartDataSet.circleColors = [
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 255/255, green: 0/255, blue: 0/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1),
UIColor(red: 14/255, green: 69/255, blue: 124/255, alpha: 1)
]
var limitLegend = LegendEntry.init(label: "Mi ubicación actual", form: .default, formSize: CGFloat.nan, formLineWidth: CGFloat.nan, formLineDashPhase: CGFloat.nan, formLineDashLengths: nil, formColor: UIColor(red: 255/255, green: 0/255, blue: 0/255, alpha: 1))
lineChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInBounce)
chartDataSet.mode = .cubicBezier
chartData.addDataSet(chartDataSet)
var limit = ChartLimitLine(limit: averageCost,label: "")
var limitLegend2 = LegendEntry.init(label: "Mi consumo promedio", form: .default, formSize: CGFloat.nan, formLineWidth: CGFloat.nan, formLineDashPhase: CGFloat.nan, formLineDashLengths: nil, formColor: UIColor(red: 30/255, green: 200/255, blue: 30/255, alpha: 1))
limit.lineColor = UIColor(red: 30/255, green: 200/255, blue: 30/255, alpha: 1)
lineChartView.legend.extraEntries = [limitLegend, limitLegend2]
lineChartView.data = chartData
lineChartView.xAxis.granularityEnabled = true
lineChartView.xAxis.granularity = 1.0
lineChartView.zoomToCenter(scaleX: 15, scaleY: 0.5)
lineChartView.moveViewToX(8.0)
lineChartView.leftAxis.addLimitLine(limit)
}
func JSONParseArray(_ string: String) -> [AnyObject]{
if let data = string.data(using: String.Encoding.utf8){
do{
if let array = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as? [AnyObject] {
return array
}
}catch{
print("error")
//handle errors here
}
}
return [AnyObject]()
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| 50.492537 | 473 | 0.606759 |
ddf1c04de0300d26b5ff58201efc9bcf82ef01a1 | 1,091 | php | PHP | wp-content/themes/wpbit4bytes/template-parts/listing/post/grid.php | mZabcic/WP-Graphql-News | fcc9b54f6fdd2bbe43bbd8b929549d861e5e2f74 | [
"MIT"
] | 1 | 2020-01-22T17:52:38.000Z | 2020-01-22T17:52:38.000Z | wp-content/themes/wpbit4bytes/template-parts/listing/post/grid.php | mZabcic/WP-Graphql-News | fcc9b54f6fdd2bbe43bbd8b929549d861e5e2f74 | [
"MIT"
] | 5 | 2021-03-09T00:36:50.000Z | 2022-03-24T05:37:06.000Z | wp-content/themes/wpbit4bytes/template-parts/listing/post/grid.php | mZabcic/WP-Graphql-News | fcc9b54f6fdd2bbe43bbd8b929549d861e5e2f74 | [
"MIT"
] | null | null | null | <?php
/**
* Grid Article
*
* @package Wpbit4bytes\Template_Parts\Listing\Articles
*/
use Wpbit4bytes\Theme\Utils as Utils;
$images = new Utils\Images();
$image = $images->get_post_image( 'listing-grid' );
?>
<div class="post-grid">
<div class="post-grid__container">
<a class="post-grid__image-link" href="<?php the_permalink(); ?>" style="background-image1:url(<?php echo esc_url( $image['image'] ); ?>)">
<div class="post-grid__image">
<?php the_post_thumbnail('listing-grid'); ?>
</div>
</a>
<div class="post-grid__content">
<header class="post-grid__heading">
<h2 class="post-grid__heading-title">
<a class="post-grid__heading-link" href="<?php the_permalink(); ?>">
<?php esc_html( the_title() ); ?>
</a>
<span class="post-grid__date">
<?php echo get_the_date(); ?>
</span>
</h2>
</header>
<div class="post-grid__excerpt content-section-style">
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php require locate_template( 'template-parts/parts/google-rich-snippets.php' ); ?>
</div>
| 29.486486 | 141 | 0.624198 |
4a45367d7b9297ec901f93566ee4063876918b0e | 297 | cs | C# | UnityEngine/YieldInstructions/WaitForSeconds.cs | NathanWarden/unity-godot-compat | ef16acecd734dc086947a3d035fd63d9af41a484 | [
"MIT"
] | 13 | 2018-05-02T13:16:37.000Z | 2021-11-26T09:57:45.000Z | UnityEngine/YieldInstructions/WaitForSeconds.cs | NathanWarden/unity-godot-compat | ef16acecd734dc086947a3d035fd63d9af41a484 | [
"MIT"
] | 1 | 2018-05-05T23:33:57.000Z | 2018-05-05T23:33:57.000Z | UnityEngine/YieldInstructions/WaitForSeconds.cs | NathanWarden/unity-godot-compat | ef16acecd734dc086947a3d035fd63d9af41a484 | [
"MIT"
] | 4 | 2019-10-17T02:33:28.000Z | 2021-12-04T05:34:05.000Z | namespace UnityEngine
{
public class WaitForSeconds : CustomYieldInstruction
{
public float finishTime;
public WaitForSeconds (float seconds)
{
finishTime = Time.time + seconds;
}
public override bool keepWaiting
{
get
{
return finishTime > Time.time;
}
}
}
} | 13.5 | 53 | 0.676768 |
752c29f48f1b3be49da0a290fa356beca6135ded | 3,390 | cs | C# | Protocol/_ClientCapabilities_Workspace.cs | kaby76/lsp-types | 57e88a7cc6ce63a98040397be7281aa5689ada12 | [
"MIT"
] | 13 | 2021-01-09T13:51:07.000Z | 2022-03-14T10:25:00.000Z | Protocol/_ClientCapabilities_Workspace.cs | kaby76/lsp-types | 57e88a7cc6ce63a98040397be7281aa5689ada12 | [
"MIT"
] | 8 | 2021-01-01T11:08:37.000Z | 2022-03-06T20:28:58.000Z | Protocol/_ClientCapabilities_Workspace.cs | kaby76/lsp-types | 57e88a7cc6ce63a98040397be7281aa5689ada12 | [
"MIT"
] | 3 | 2021-03-31T06:59:27.000Z | 2022-03-06T18:30:39.000Z | using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace LspTypes
{
[DataContract]
public class _ClientCapabilities_Workspace
{
public _ClientCapabilities_Workspace() { }
/**
* The client supports applying batch edits
* to the workspace by supporting the request
* 'workspace/applyEdit'
*/
[DataMember(Name = "applyEdit")]
[JsonProperty(Required = Required.Default)]
public bool? ApplyEdit { get; set; }
/**
* Capabilities specific to `WorkspaceEdit`s
*/
[DataMember(Name = "workspaceEdit")]
[JsonProperty(Required = Required.Default)]
public WorkspaceEditClientCapabilities WorkspaceEdit { get; set; }
/**
* Capabilities specific to the `workspace/didChangeConfiguration`
* notification.
*/
[DataMember(Name = "didChangeConfiguration")]
[JsonProperty(Required = Required.Default)]
public DidChangeConfigurationClientCapabilities DidChangeConfiguration { get; set; }
/**
* Capabilities specific to the `workspace/didChangeWatchedFiles`
* notification.
*/
[DataMember(Name = "didChangeWatchedFiles")]
[JsonProperty(Required = Required.Default)]
public DidChangeWatchedFilesClientCapabilities DidChangeWatchedFiles { get; set; }
/**
* Capabilities specific to the `workspace/symbol` request.
*/
[DataMember(Name = "symbol")]
[JsonProperty(Required = Required.Default)]
public WorkspaceSymbolClientCapabilities Symbol { get; set; }
/**
* Capabilities specific to the `workspace/executeCommand` request.
*/
[DataMember(Name = "executeCommand")]
[JsonProperty(Required = Required.Default)]
public ExecuteCommandClientCapabilities ExecuteCommand { get; set; }
/**
* The client has support for workspace folders.
*
* @since 3.6.0
*/
[DataMember(Name = "workspaceFolders")]
[JsonProperty(Required = Required.Default)]
public bool? WorkspaceFolders { get; set; }
/**
* The client supports `workspace/configuration` requests.
*
* @since 3.6.0
*/
[DataMember(Name = "configuration")]
[JsonProperty(Required = Required.Default)]
public bool? Configuration { get; set; }
/**
* Capabilities specific to the semantic token requests scoped to the
* workspace.
*
* @since 3.16.0
*/
[DataMember(Name = "semanticTokens")]
[JsonProperty(Required = Required.Default)]
public SemanticTokensWorkspaceClientCapabilities SemanticTokens { get; set; }
/**
* Capabilities specific to the code lens requests scoped to the
* workspace.
*
* @since 3.16.0
*/
[DataMember(Name = "codeLens")]
[JsonProperty(Required = Required.Default)]
public CodeLensWorkspaceClientCapabilities CodeLens { get; set; }
/**
* The client has support for file requests/notifications.
*
* @since 3.16.0
*/
[DataMember(Name = "fileOperations")]
[JsonProperty(Required = Required.Default)]
public _ClientCapabilities_Workspace_FileOperations fileOperations { get; set; }
}
} | 32.285714 | 92 | 0.618289 |
6c9fb16c4b46141e57b2f50309be95cf06153f74 | 178 | go | Go | main.go | thisissoon-fm/trackstore | f9f96ead78c45ca29ee52e5dd0657ce792cdf60f | [
"MIT"
] | null | null | null | main.go | thisissoon-fm/trackstore | f9f96ead78c45ca29ee52e5dd0657ce792cdf60f | [
"MIT"
] | null | null | null | main.go | thisissoon-fm/trackstore | f9f96ead78c45ca29ee52e5dd0657ce792cdf60f | [
"MIT"
] | null | null | null | package main
import (
"trackstore/cli"
"trackstore/log"
)
func main() {
if err := cli.Execute(); err != nil {
log.WithError(err).Error("application execution error")
}
}
| 13.692308 | 57 | 0.657303 |
39ef82a942ce06ba1d75edd7fab55f6b69d3966d | 20,105 | kt | Kotlin | src/main/kotlin/com/hawkstech/intellij/plugin/fernflower/DecompileWithOptionsPlugin.kt | awhawks/IntelliJ_Decompiler_Plugin | 1467a244749cd88f14fd288ecf23403c1ca978a8 | [
"MIT"
] | null | null | null | src/main/kotlin/com/hawkstech/intellij/plugin/fernflower/DecompileWithOptionsPlugin.kt | awhawks/IntelliJ_Decompiler_Plugin | 1467a244749cd88f14fd288ecf23403c1ca978a8 | [
"MIT"
] | null | null | null | src/main/kotlin/com/hawkstech/intellij/plugin/fernflower/DecompileWithOptionsPlugin.kt | awhawks/IntelliJ_Decompiler_Plugin | 1467a244749cd88f14fd288ecf23403c1ca978a8 | [
"MIT"
] | null | null | null | package com.hawkstech.intellij.plugin.fernflower
import com.google.common.base.Preconditions.checkNotNull
import com.google.common.base.Preconditions.checkState
import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.ide.util.PropertiesComponent
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.ex.ApplicationManagerEx
import com.intellij.openapi.command.WriteCommandAction.writeCommandAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.module.Module
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.Task
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.*
import com.intellij.openapi.roots.libraries.Library
import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.*
import com.intellij.ui.components.LegalNoticeDialog
import com.intellij.util.CommonProcessors
import com.intellij.util.SystemProperties
import org.jetbrains.annotations.NotNull
import org.jetbrains.java.decompiler.main.DecompilerContext
import org.jetbrains.java.decompiler.main.Fernflower
import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences
import org.jetbrains.java.decompiler.main.extern.IResultSaver
import org.jetbrains.java.decompiler.util.InterpreterUtil
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.io.OutputStreamWriter
import java.nio.charset.StandardCharsets
import java.util.*
import java.util.jar.JarOutputStream
import java.util.jar.Manifest
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
import java.util.zip.ZipOutputStream
import kotlin.collections.HashMap
/**
* Created by bduisenov on 12/11/15. as DecompileAndAttacheAction
* updated rferguson 12/9/17 and 9/2/18.
* expanded with extra function awhawks 4/3/2019
*/
class DecompileWithOptionsPlugin: AnAction(), IBytecodeProvider, IResultSaver {
private val logger = Logger.getInstance(DecompileWithOptionsPlugin::class.java)
// From IdeaDecompiler
private val legalNoticeKey = "decompiler.legal.notice.accepted"
private val declineExitCode = DialogWrapper.NEXT_USER_EXIT_CODE
private var isAttachOption:Boolean = false
private var decompiledJarDir:String = "NotSetYet"
private var decompiledSrcDir:String = "NotSetYet"
private var decompilerOptions:MutableMap<String, Any> = mutableMapOf()
private var tmpDir:File = File("NotSetYet")
/**
* show 'decompile and attach' option only for *.jar files
* @param e AnActionEvent
*/
override fun update(e: AnActionEvent) {
val presentation = e.presentation
presentation.isEnabled = false
presentation.isVisible = false
val virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE)
if (virtualFile != null &&
"jar" == virtualFile.extension &&
e.project != null) {
presentation.isEnabled = true
presentation.isVisible = true
}
}
override fun actionPerformed(event: AnActionEvent) {
val project = event.project ?: return
val selectedJarfile:VirtualFile? = DataKeys.VIRTUAL_FILE.getData(event.dataContext)
val selectedJarFolder:VirtualFile = selectedJarfile!!.parent
val storedSettings = SettingsUtils(project, selectedJarFolder)
if (!PropertiesComponent.getInstance().isValueSet(legalNoticeKey)) {
val title = LegalBundle.message("legal.notice.title", "Legal Terms")
val message = LegalBundle.message("legal.notice.text")
val answer = LegalNoticeDialog.build(title, message)
.withCancelText("Decide Later")
.withCustomAction("Decline and restart", declineExitCode)
.show()
when (answer) {
DialogWrapper.OK_EXIT_CODE -> {
PropertiesComponent.getInstance().setValue(legalNoticeKey, true)
logger.info("Decompiler legal notice accepted.")
}
declineExitCode -> {
PluginManagerCore.disablePlugin("com.hawkstech.intellij.plugin.fernflowerdecompiler")
ApplicationManagerEx.getApplicationEx().restart(true)
logger.info("Decompiler legal notice rejected, disabling decompile and attach plugin.")
return
}
else -> {
Notification("DecompileAndAttach", "Decompile request rejected",
"Decompiler cannot continue until terms of use are accepted.", NotificationType.INFORMATION)
.notify(project)
return
}
}
}
val sourceVFs = event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)
checkState(sourceVFs != null && sourceVFs.isNotEmpty(), "event#getData(VIRTUAL_FILE_ARRAY) returned empty array")
val content = DecompileOptionsUI(project, storedSettings)
if(content.showAndGet()) {
isAttachOption = content.getAttachOption()
decompiledJarDir = content.getDecompiledJarDir()
decompiledSrcDir = content.getDecompiledSrcDir()
content.getParsedOptions().forEach{ entry ->
val fernKey = when(entry.key){
SettingsUtils.SettingNames.REMOVE_BRIDGE -> IFernflowerPreferences.REMOVE_BRIDGE
SettingsUtils.SettingNames.REMOVE_SYNTHETIC -> IFernflowerPreferences.REMOVE_SYNTHETIC
SettingsUtils.SettingNames.DECOMPILE_INNER -> IFernflowerPreferences.DECOMPILE_INNER
SettingsUtils.SettingNames.DECOMPILE_CLASS_1_4 -> IFernflowerPreferences.DECOMPILE_CLASS_1_4
SettingsUtils.SettingNames.DECOMPILE_ASSERTIONS -> IFernflowerPreferences.DECOMPILE_ASSERTIONS
SettingsUtils.SettingNames.HIDE_EMPTY_SUPER -> IFernflowerPreferences.HIDE_EMPTY_SUPER
SettingsUtils.SettingNames.HIDE_DEFAULT_CONSTRUCTOR -> IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR
SettingsUtils.SettingNames.DECOMPILE_GENERIC_SIGNATURES -> IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES
SettingsUtils.SettingNames.NO_EXCEPTIONS_RETURN -> IFernflowerPreferences.NO_EXCEPTIONS_RETURN
SettingsUtils.SettingNames.ENSURE_SYNCHRONIZED_MONITOR -> IFernflowerPreferences.ENSURE_SYNCHRONIZED_MONITOR
SettingsUtils.SettingNames.DECOMPILE_ENUM -> IFernflowerPreferences.DECOMPILE_ENUM
SettingsUtils.SettingNames.REMOVE_GET_CLASS_NEW -> IFernflowerPreferences.REMOVE_GET_CLASS_NEW
SettingsUtils.SettingNames.LITERALS_AS_IS -> IFernflowerPreferences.LITERALS_AS_IS
SettingsUtils.SettingNames.BOOLEAN_TRUE_ONE -> IFernflowerPreferences.BOOLEAN_TRUE_ONE
SettingsUtils.SettingNames.ASCII_STRING_CHARACTERS -> IFernflowerPreferences.ASCII_STRING_CHARACTERS
SettingsUtils.SettingNames.SYNTHETIC_NOT_SET -> IFernflowerPreferences.SYNTHETIC_NOT_SET
SettingsUtils.SettingNames.UNDEFINED_PARAM_TYPE_OBJECT -> IFernflowerPreferences.UNDEFINED_PARAM_TYPE_OBJECT
SettingsUtils.SettingNames.USE_DEBUG_VAR_NAMES -> IFernflowerPreferences.USE_DEBUG_VAR_NAMES
SettingsUtils.SettingNames.USE_METHOD_PARAMETERS -> IFernflowerPreferences.USE_METHOD_PARAMETERS
SettingsUtils.SettingNames.REMOVE_EMPTY_RANGES -> IFernflowerPreferences.REMOVE_EMPTY_RANGES
SettingsUtils.SettingNames.FINALLY_DEINLINE -> IFernflowerPreferences.FINALLY_DEINLINE
SettingsUtils.SettingNames.IDEA_NOT_NULL_ANNOTATION -> IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION
SettingsUtils.SettingNames.LAMBDA_TO_ANONYMOUS_CLASS -> IFernflowerPreferences.LAMBDA_TO_ANONYMOUS_CLASS
SettingsUtils.SettingNames.BYTECODE_SOURCE_MAPPING -> IFernflowerPreferences.BYTECODE_SOURCE_MAPPING
SettingsUtils.SettingNames.IGNORE_INVALID_BYTECODE -> IFernflowerPreferences.IGNORE_INVALID_BYTECODE
SettingsUtils.SettingNames.VERIFY_ANONYMOUS_CLASSES -> IFernflowerPreferences.VERIFY_ANONYMOUS_CLASSES
SettingsUtils.SettingNames.LOG_LEVEL -> IFernflowerPreferences.LOG_LEVEL
SettingsUtils.SettingNames.MAX_PROCESSING_METHOD -> IFernflowerPreferences.MAX_PROCESSING_METHOD
SettingsUtils.SettingNames.RENAME_ENTITIES -> IFernflowerPreferences.RENAME_ENTITIES
//TODO SettingsUtils.SettingNames.USER_RENAMER_CLASS -> IFernflowerPreferences.USER_RENAMER_CLASS
SettingsUtils.SettingNames.NEW_LINE_SEPARATOR -> IFernflowerPreferences.NEW_LINE_SEPARATOR
SettingsUtils.SettingNames.INDENT_STRING -> IFernflowerPreferences.INDENT_STRING
SettingsUtils.SettingNames.BANNER -> IFernflowerPreferences.BANNER
//SettingsUtils.SettingNames.DUMP_ORIGINAL_LINES -> IFernflowerPreferences.DUMP_ORIGINAL_LINES
//SettingsUtils.SettingNames.UNIT_TEST_MODE -> IFernflowerPreferences.UNIT_TEST_MODE
else -> ""
}
if( fernKey.isNotEmpty() && entry.value.isNotEmpty() ) {
decompilerOptions[fernKey] = entry.value
}
}
object : Task.Backgroundable(project, "Decompiling...", true) {
override fun run(@NotNull indicator: ProgressIndicator) {
indicator.fraction = 0.1
sourceVFs!!.toList().stream() //
.filter { vf -> "jar" == vf.extension } //
.forEach { sourceVF ->
process(project, sourceVF, indicator, 1.0 / sourceVFs.size)
}
indicator.fraction = 1.0
VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL).refresh(true)
}
override fun shouldStartInBackground(): Boolean {
return true
}
}.queue()
}
}
private fun process(project: Project, sourceVF: VirtualFile, indicator: ProgressIndicator, fractionStep: Double):File {
indicator.text = "Decompiling '" + sourceVF.name + "'"
val libraryName = sourceVF.name.replace(".jar", "-sources.jar")
val fullPath = decompiledJarDir + File.separator + libraryName
var outputFile = File(fullPath)
val jarFileSystemInstance = JarFileSystem.getInstance()
val jarRoot = jarFileSystemInstance.getJarRootForLocalFile(sourceVF)?: jarFileSystemInstance.getJarRootForLocalFile(Objects.requireNonNull<VirtualFile>(jarFileSystemInstance.getVirtualFileForJar(sourceVF)))!!
val jdkRtJar = File( SystemProperties.getJavaHome(), "jre/lib/rt.jar")
val jreRtJar = File( SystemProperties.getJavaHome(), "lib/rt.jar")
val useRtJar = jdkRtJar.exists() || jreRtJar.exists()
try {
tmpDir = FileUtil.createTempDirectory("decompiledTempDIR","ext")
val tmpJarFile = File(tmpDir, sourceVF.name )
val srcJar = File(jarRoot.canonicalPath!!.dropLast(2))
try {
val fernLogger = DecompileWithOptionsLogger()
//val fernLogger = PrintStreamLogger(System.out)
val engine = Fernflower(this, this, decompilerOptions, fernLogger)
if(useRtJar) {
val rtJar:File = if( jdkRtJar.exists() ) jdkRtJar else jreRtJar
engine.addLibrary(rtJar);
}
engine.addSource(srcJar)
try {
engine.decompileContext()
} catch(exc:Throwable) {
exc.printStackTrace()
} finally {
engine.clearContext()
}
if (outputFile.exists()) {
FileUtil.deleteWithRenaming(outputFile)
outputFile = File(fullPath)
outputFile.createNewFile()
}
} catch (e:Exception){
Notification("DecompileWithOptions", "Jar lib couldn't be decompiled",
"Fernflower args: $decompilerOptions ${srcJar.absolutePath} ${tmpDir.absolutePath}", NotificationType.ERROR).notify(project)
FileUtil.delete(tmpJarFile)
FileUtil.delete(tmpDir)
} finally {
if(tmpJarFile.exists()){
FileUtil.copy(tmpJarFile, outputFile)
if(isAttachOption) {
attach(project, sourceVF, outputFile)
}
indicator.fraction = indicator.fraction + fractionStep * 30 / 100
FileUtil.delete(tmpJarFile)
FileUtil.delete(tmpDir)
ZipFile(outputFile.absolutePath).use { zip ->
zip.entries().asSequence().forEach { entry ->
if(entry.isDirectory){
val dstDir = File("$decompiledSrcDir/${entry.name}")
if (!dstDir.exists()) {
dstDir.parentFile.mkdirs()
}
} else {
zip.getInputStream(entry).use { input ->
val dstFile = File("$decompiledSrcDir/${entry.name}")
if (!dstFile.exists()) {
dstFile.parentFile.mkdirs()
dstFile.createNewFile()
}
if (dstFile.isFile) {
dstFile.outputStream().use { output ->
input.copyTo(output)
}
}
}
}
}
}
} else {
Notification("DecompileWithOptions", "Jar lib couldn't be decompiled",
"Fernflower args: ${tmpJarFile.absolutePath} was not generated", NotificationType.ERROR).notify(project)
}
}
} catch (e: IOException) {
Notification("DecompileWithOptions", "Jar lib couldn't be decompiled",
sourceVF.name + " " + e.javaClass.name + " " + e.toString(), NotificationType.ERROR).notify(project)
}
return outputFile
}
private fun attach(project: Project?, sourceVF: VirtualFile, resultJar: File) {
ApplicationManager.getApplication().invokeAndWait({
val resultJarVF = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(resultJar)!!
checkNotNull(resultJarVF, "could not find Virtual File of %s", resultJar.absolutePath)
val resultJarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(resultJarVF)!!
val roots = LibrarySourceRootDetectorUtil.scanAndSelectDetectedJavaSourceRoots(null,
arrayOf(resultJarRoot))
writeCommandAction(project).run<RuntimeException> {
val currentModule = ProjectRootManager.getInstance(project!!).fileIndex .getModuleForFile(sourceVF, false)
if (currentModule != null) {
val moduleLib = findModuleDependency(currentModule, sourceVF)
checkState(moduleLib.isPresent, "could not find library in module dependencies")
val model = moduleLib.get().modifiableModel
for (root in roots) {
model.addRoot(root, OrderRootType.SOURCES)
}
model.commit()
Notification("DecompileAndAttach", "Jar Sources Added", "decompiled sources " + resultJar.name
+ " where added successfully to dependency of a module '" + currentModule.name + "'",
NotificationType.INFORMATION).notify(project)
} else if ("jar" != sourceVF.extension) {
Notification("DecompileAndAttach", "Failed getModule",
"File is " + sourceVF.name, NotificationType.WARNING).notify(project)
}
}
}, ModalityState.NON_MODAL)
}
private fun findModuleDependency(module: Module, sourceVF: VirtualFile): Optional<Library> {
val processor = object : CommonProcessors.FindProcessor<OrderEntry>() {
override fun accept(orderEntry: OrderEntry): Boolean {
val urls = orderEntry.getUrls(OrderRootType.CLASSES)
val contains = Arrays.asList(*urls).contains("jar://" + sourceVF.path + "!/")
return contains && orderEntry is LibraryOrderEntry
}
}
ModuleRootManager.getInstance(module).orderEntries().forEach(processor)
var result: Library? = null
if (processor.foundValue != null) {
result = (processor.foundValue as LibraryOrderEntry).library
}
return Optional.ofNullable(result)
}
private val mapArchiveStreams = HashMap<String, ZipOutputStream>()
private val mapArchiveEntries = HashMap<String, Set<String>>()
// *******************************************************************
// Utility functions used by Interface IResultSaver
// *******************************************************************
private fun getAbsolutePath(path: String): String {
return File(tmpDir, path).absolutePath
}
private fun checkEntry(entryName: String, file: String): Boolean {
val set:Set<String> = mapArchiveEntries.getOrPut(file) { HashSet() }
val added = !set.contains(entryName)
set.plus( entryName )
if (!added) {
val message = "Zip file $file already has entry $entryName"
DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN)
}
return added
}
// *******************************************************************
// Interface IBytecodeProvider
// *******************************************************************
@Throws(IOException::class)
override fun getBytecode(externalPath: String, internalPath: String?): ByteArray {
val file = File(externalPath)
if (internalPath == null) {
return InterpreterUtil.getBytes(file)
} else {
ZipFile(file).use { archive ->
val entry = archive.getEntry(internalPath) ?: throw IOException("Entry not found: $internalPath")
return InterpreterUtil.getBytes(archive, entry)
}
}
}
// *******************************************************************
// Interface IResultSaver
// *******************************************************************
override fun saveFolder(path: String) {
val dir = File(getAbsolutePath(path))
if (!(dir.mkdirs() || dir.isDirectory)) {
throw RuntimeException("Cannot create directory $dir")
}
}
override fun closeArchive(path: String, archiveName: String) {
val file = File(getAbsolutePath(path), archiveName).path
try {
mapArchiveEntries.remove(file)
mapArchiveStreams.remove(file)?.close()
} catch (ex: IOException) {
DecompilerContext.getLogger().writeMessage("Cannot close $file", IFernflowerLogger.Severity.WARN)
}
}
override fun copyFile(source: String, path: String, entryName: String) {
try {
InterpreterUtil.copyFile(File(source), File(getAbsolutePath(path), entryName))
} catch (ex: IOException) {
DecompilerContext.getLogger().writeMessage("Cannot copy $source to $entryName", ex)
}
}
override fun copyEntry(source: String, path: String, archiveName: String, entryName: String) {
val file = File(getAbsolutePath(path), archiveName).path
if (!checkEntry(entryName, file)) {
return
}
try {
ZipFile(File(source)).use { srcArchive ->
val entry = srcArchive.getEntry(entryName)
if (entry != null) {
srcArchive.getInputStream(entry).use { `in` ->
val out = mapArchiveStreams[file]!!
out.putNextEntry(ZipEntry(entryName))
InterpreterUtil.copyStream(`in`, out)
}
}
}
} catch (ex: IOException) {
val message = "Cannot copy entry $entryName from $source to $file"
DecompilerContext.getLogger().writeMessage(message, ex)
}
}
override fun saveClassEntry(path: String, archiveName: String, qualifiedName: String?, entryName: String, content: String?) {
val file = File(getAbsolutePath(path), archiveName).path
if (!checkEntry(entryName, file)) {
return
}
try {
val out = mapArchiveStreams[file]!!
out.putNextEntry(ZipEntry(entryName))
if (content != null) {
out.write(content.toByteArray(StandardCharsets.UTF_8))
}
} catch (ex: IOException) {
val message = "Cannot write entry $entryName to $file"
DecompilerContext.getLogger().writeMessage(message, ex)
}
}
override fun createArchive(path: String, archiveName: String, manifest: Manifest?) {
val file = File(getAbsolutePath(path), archiveName)
try {
if (!(file.createNewFile() || file.isFile)) {
throw IOException("Cannot create file $file")
}
val fileStream = FileOutputStream(file)
val zipStream = manifest?.let { JarOutputStream(fileStream, it) } ?: ZipOutputStream(fileStream)
mapArchiveStreams[file.path] = zipStream
} catch (ex: IOException) {
DecompilerContext.getLogger().writeMessage("Cannot create archive $file", ex)
}
}
override fun saveClassFile(path: String, qualifiedName: String, entryName: String, content: String, mapping: IntArray) {
val file = File(getAbsolutePath(path), entryName)
try {
OutputStreamWriter(FileOutputStream(file), StandardCharsets.UTF_8).use { out -> out.write(content) }
} catch (ex: IOException) {
DecompilerContext.getLogger().writeMessage("Cannot write class file $file", ex)
}
}
override fun saveDirEntry(path: String, archiveName: String, entryName: String) {
saveClassEntry(path, archiveName, null, entryName, null)
}
}
| 42.867804 | 210 | 0.727481 |
286b41ae86ab14e21d4e8240cacc94905a998871 | 984 | hpp | C++ | libs/boost_1_72_0/boost/fusion/container/vector/detail/equal_to_impl.hpp | henrywarhurst/matrix | 317a2a7c35c1c7e3730986668ad2270dc19809ef | [
"BSD-3-Clause"
] | null | null | null | libs/boost_1_72_0/boost/fusion/container/vector/detail/equal_to_impl.hpp | henrywarhurst/matrix | 317a2a7c35c1c7e3730986668ad2270dc19809ef | [
"BSD-3-Clause"
] | null | null | null | libs/boost_1_72_0/boost/fusion/container/vector/detail/equal_to_impl.hpp | henrywarhurst/matrix | 317a2a7c35c1c7e3730986668ad2270dc19809ef | [
"BSD-3-Clause"
] | null | null | null | /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_EQUAL_TO_IMPL_05052005_1215)
#define FUSION_EQUAL_TO_IMPL_05052005_1215
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost {
namespace fusion {
struct vector_iterator_tag;
namespace extension {
template <typename Tag> struct equal_to_impl;
template <> struct equal_to_impl<vector_iterator_tag> {
template <typename I1, typename I2>
struct apply : is_same<typename I1::identity, typename I2::identity> {};
};
} // namespace extension
} // namespace fusion
} // namespace boost
#endif
| 31.741935 | 80 | 0.645325 |
f417296d630ee7a8ec47c85e058eb5c33d9f634e | 805 | ps1 | PowerShell | fyyd/Get-FyydEpisode.ps1 | shiller79/PodShell | ba2bd6e4b97cfe194b99685c5c7efbc7b5828063 | [
"MIT"
] | null | null | null | fyyd/Get-FyydEpisode.ps1 | shiller79/PodShell | ba2bd6e4b97cfe194b99685c5c7efbc7b5828063 | [
"MIT"
] | null | null | null | fyyd/Get-FyydEpisode.ps1 | shiller79/PodShell | ba2bd6e4b97cfe194b99685c5c7efbc7b5828063 | [
"MIT"
] | null | null | null | <#
.Synopsis
Returns information about a single episode.
.DESCRIPTION
Gets information about the episode with id
.EXAMPLE
Get-FyydEpisode -id 1209129
#>
function Get-FyydEpisode {
[OutputType('Episode')]
[CmdletBinding()]
param (
[Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true, Position = 0)]
[Alias("id", "FyydEpisodeId")]
[int] $episode_id
)
Begin {}
Process {
[string[]] $parameter = @() # init parameter array
$parameter += "episode_id=$episode_id"
$jsondata = Invoke-FyydApi -parameter $parameter -endpoint "/episode" -method "Get"
$outobject = Convert-FyydJson2EpisodeObject $jsondata.data
return $outobject
}
End {}
}
Export-ModuleMember Get-FyydEpisode | 25.15625 | 93 | 0.639752 |
fe3a010c01b47f9826088a4cdff352409d24a404 | 1,556 | cpp | C++ | B2G/gecko/content/svg/content/src/nsSVGPathGeometryElement.cpp | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/content/svg/content/src/nsSVGPathGeometryElement.cpp | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/content/svg/content/src/nsSVGPathGeometryElement.cpp | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSVGPathGeometryElement.h"
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGPathGeometryElement, nsSVGPathGeometryElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGPathGeometryElement, nsSVGPathGeometryElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGPathGeometryElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTests)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGPathGeometryElement::nsSVGPathGeometryElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGPathGeometryElementBase(aNodeInfo)
{
}
bool
nsSVGPathGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
{
// Check for nsSVGLength2 attribute
LengthAttributesInfo info = GetLengthInfo();
for (uint32_t i = 0; i < info.mLengthCount; i++) {
if (aName == *info.mLengthInfo[i].mName) {
return true;
}
}
return false;
}
bool
nsSVGPathGeometryElement::IsMarkable()
{
return false;
}
void
nsSVGPathGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
{
}
already_AddRefed<gfxFlattenedPath>
nsSVGPathGeometryElement::GetFlattenedPath(const gfxMatrix &aMatrix)
{
return nullptr;
}
| 27.785714 | 91 | 0.708226 |
0b36b0a444f2d74d0736b72d8524d171de6f01c9 | 9,236 | py | Python | kkl_wikicommons_upload.py | wmilbot/wikiscraper | c0e8c2ac45bcb275584fa6606c604ee7c9c9cea7 | [
"MIT"
] | 3 | 2018-11-14T14:06:09.000Z | 2018-11-14T18:23:16.000Z | kkl_wikicommons_upload.py | wmilbot/wikiscraper | c0e8c2ac45bcb275584fa6606c604ee7c9c9cea7 | [
"MIT"
] | null | null | null | kkl_wikicommons_upload.py | wmilbot/wikiscraper | c0e8c2ac45bcb275584fa6606c604ee7c9c9cea7 | [
"MIT"
] | 2 | 2018-11-14T14:06:23.000Z | 2019-09-22T08:25:55.000Z | #!/usr/bin/env python
from datapackage_pipelines.wrapper import ingest, spew
import logging, collections
from pipeline_params import get_pipeline_param_rows
from google.cloud import storage
from contextlib import contextmanager
from tempfile import mkdtemp
import os
import pywikibot
import time
from pywikibot.pagegenerators import GeneratorFactory
import datetime
from pywikibot.specialbots import UploadRobot
from pywikibot.data.api import APIError
import sys
from datapackage import Package
LICENSE_TEMPLATE = "PD-Israel"
SUPPORTED_TEMPLATE = "Supported by Wikimedia Israel|year=2018"
FILES_CATEGORY = "Files from JNF uploaded by Wikimedia Israel"
FILES_CATEGORY_ID = "Files_from_JNF_uploaded_by_Wikimedia_Israel"
DESCRIPTION_TEMPLATE=lambda description, datestring, source, author, jnfnum: """=={{int:filedesc}}==
{{Information
|description={{he|1=__DESCRIPTION__}}
|date=__DATESTRING__
|source={{he|1=__SOURCE__}}
|author={{he|1=__AUTHOR__}}
|permission=
|other versions=
|other fields={{Information field|Name=JNF Number|Value=__JNFNUM__}}
}}
=={{int:license-header}}==
{{__LICENSE__}}
{{__SUPPORTED__}}
[[Category:__FILESCAT__]]""".replace("__DATESTRING__", datestring) \
.replace("__SOURCE__", source) \
.replace("__AUTHOR__", author) \
.replace("__JNFNUM__", jnfnum) \
.replace("__DESCRIPTION__", description) \
.replace("__LICENSE__", LICENSE_TEMPLATE) \
.replace("__SUPPORTED__", SUPPORTED_TEMPLATE) \
.replace("__FILESCAT__", FILES_CATEGORY) \
@contextmanager
def temp_dir(*args, **kwargs):
dir = mkdtemp(*args, **kwargs)
try:
yield dir
except Exception:
if os.path.exists(dir):
os.rmdir(dir)
raise
@contextmanager
def temp_file(*args, **kwargs):
with temp_dir(*args, **kwargs) as dir:
file = os.path.join(dir, "temp")
try:
yield file
except Exception:
if os.path.exists(file):
os.unlink(file)
raise
@contextmanager
def throttle(delay_seconds=None):
delay_seconds = int(os.environ.get("THROTTLE_SECONDS", "1")) if not delay_seconds else delay_seconds
if hasattr(throttle, 'last_call'):
seconds_since_last_call = (datetime.datetime.now() - throttle.last_call).seconds
if seconds_since_last_call < delay_seconds:
logging.info("throttling {} seconds...".format(delay_seconds - seconds_since_last_call))
time.sleep(delay_seconds - seconds_since_last_call)
yield
throttle.last_call = datetime.datetime.now()
def delete_page(page):
with throttle():
page.delete(reason="Deleting duplicated images created by bot", prompt=True, mark=True)
def get_gcs_bucket(consts):
logging.info("uploading from google storage bucket {}".format(consts["gcs_bucket"]))
gcs = storage.Client.from_service_account_json(consts["gcs_secret_file"])
return gcs.get_bucket(consts["gcs_bucket"])
def init_stats():
stats = {}
stats["num eligible for download"] = 0
stats["invalid resolution"] = 0
stats["invalid description"] = 0
stats["invalid source"] = 0
stats["invalid year"] = 0
stats["in skip list"] = 0
stats["skipped start at"] = 0
stats['invalid image_path'] = 0
return stats
def get_donum_from_row(row):
return row["image_path"].replace("/ArchiveTazlumim/TopSmlPathArc/Do", "").replace(".jpeg", "")
def is_valid_row(row, stats):
if row["width_px"] * row["height_px"] < 200 * 200:
stats["invalid resolution"] += 1
logging.info('invalid resolution: {} X {}'.format(row["width_px"], row["height_px"]))
return False
elif len(row["description"]) < 3:
stats["invalid description"] += 1
logging.info('invalid description: {}'.format(row["description"]))
return False
elif len(row["source"]) < 2:
stats["invalid source"] += 1
logging.info('invalid source: {}'.format(row["source"]))
return False
elif row["date"].year > 1947:
stats["invalid year"] += 1
logging.info('invalid year: {}'.format(row["date"]))
return False
elif 'mi:' in row['image_path']:
stats['invalid image_path'] += 1
logging.info('invalid image path: {}'.format(row['image_path']))
return False
else:
stats["num eligible for download"] += 1
return True
# def load_datapackage_resources(resources, stats):
# logging.info("Loading datapackage resources...")
# donums = {}
# start_at_donum = False
# reached_start_at = False
# for resource in resources:
# for row_num, row in enumerate(resource, start=1):
# donum = get_donum_from_row(row)
# if start_at_donum and not reached_start_at and donum != start_at_donum:
# stats["skipped start at"] += 1
# elif is_valid_row(row, stats):
# if start_at_donum and donum == start_at_donum:
# reached_start_at = True
# donums[donum] = row
# stats["num eligible for download"] += 1
# return donums
def upload(consts, parameters, row, donum, stats, retry_num=0):
if is_valid_row(row, stats):
if os.environ.get('WIKISCRAPER_DRY_RUN'):
site = None
else:
site = pywikibot.Site()
site.login()
gcs_bucket = get_gcs_bucket(consts)
blob = gcs_bucket.blob("data/kkl/images" + row["image_path"])
with temp_file() as filename:
blob.download_to_filename(filename)
logging.info(os.path.getsize(filename))
page_title = row["description"][:100] + "-JNF{}.jpeg".format(donum)
logging.info("page_title={}".format(page_title))
if os.environ.get('WIKISCRAPER_DRY_RUN'):
page = None
else:
page = pywikibot.FilePage(site, page_title)
assert page.site.family == 'commons', 'invalid page site: {}'.format(page.site)
page_text = DESCRIPTION_TEMPLATE(row["description"], str(row["date"]), 'ארכיון הצילומים של קק"ל',
row["source"], donum)
if os.environ.get('WIKISCRAPER_DRY_RUN'):
logging.info(" -- {} -- \n{}".format(filename, page_text))
else:
with throttle():
if not page.exists():
page.text = page_text
if page.upload(filename, comment="uploaded by wmilbot", ignore_warnings=True):
logging.info("uploaded successfully")
else:
raise Exception("Upload failed")
else:
page.get()
page.text = page_text
page.save(summary='update by wmilbot')
return True, ''
else:
return True, 'invalid row'
def ingest_spew():
raise NotImplementedError
# parameters, datapackage, resources = ingest()
# parameters = next(get_pipeline_param_rows(parameters["pipeline-id"], parameters["pipeline-parameters"]))
# consts = next(get_pipeline_param_rows('constants', 'kkl-parameters.csv'))
# gcs_bucket = get_gcs_bucket(consts)
# stats = init_stats()
# for donum, row in load_datapackage_resources(resources, stats).items():
# success, error = upload(gcs_bucket, parameters, row, donum)
# assert success
# spew(dict(datapackage, resources=[]), [])
def cli_upload(consts, parameters, start_donum=None, upload_limit=1):
reached_start_at = False if start_donum else True
num_uploaded = 0
package = Package('final-data/kkl/extended-metadata/datapackage.json')
stats = init_stats()
for row in package.get_resource('kkl').iter(keyed=True):
donum = get_donum_from_row(row)
if reached_start_at or donum == start_donum:
reached_start_at = True
success, error = upload(consts, parameters, row, donum, stats)
if success:
num_uploaded += 1
if upload_limit > 0 and num_uploaded >= upload_limit:
break
stats['num processed'] = num_uploaded
stats['last donum'] = donum
print(stats)
def cli():
parameters = next(get_pipeline_param_rows('kkl-wikicommons-upload', 'kkl-parameters.csv'))
consts = next(get_pipeline_param_rows('constants', 'kkl-parameters.csv'))
if len(sys.argv) > 2:
if sys.argv[2] == 'upload':
if len(sys.argv) > 3:
if sys.argv[3] == 'all':
cli_upload(consts, parameters, None, 0)
else:
cli_upload(consts, parameters, sys.argv[3])
else:
cli_upload(consts, parameters)
if sys.argv[2] == 'upload-after':
cli_upload(consts, parameters, sys.argv[3],
upload_limit=int(sys.argv[4]) if len(sys.argv) > 4 else 1)
if len(sys.argv) > 1 and sys.argv[1] == '--cli':
cli()
else:
ingest_spew()
| 37.092369 | 110 | 0.612711 |
2a23daa5553c612afb6ccd0c360b603bed03b19f | 10,423 | java | Java | ft-plugin/src/main/java/com/ft/plugin/garble/asm/FTTransform.java | GuanceCloud/datakit-android | 8a1b1eb113f33c83a4563d25fcfbbc493187cf5d | [
"Apache-2.0"
] | 10 | 2021-08-04T03:24:49.000Z | 2021-12-06T02:00:35.000Z | ft-plugin/src/main/java/com/ft/plugin/garble/asm/FTTransform.java | GuanceCloud/datakit-android | 8a1b1eb113f33c83a4563d25fcfbbc493187cf5d | [
"Apache-2.0"
] | null | null | null | ft-plugin/src/main/java/com/ft/plugin/garble/asm/FTTransform.java | GuanceCloud/datakit-android | 8a1b1eb113f33c83a4563d25fcfbbc493187cf5d | [
"Apache-2.0"
] | 2 | 2021-06-10T10:02:57.000Z | 2021-12-08T07:32:59.000Z | package com.ft.plugin.garble.asm;
import com.android.build.api.transform.Context;
import com.android.build.api.transform.DirectoryInput;
import com.android.build.api.transform.Format;
import com.android.build.api.transform.JarInput;
import com.android.build.api.transform.QualifiedContent;
import com.android.build.api.transform.Status;
import com.android.build.api.transform.Transform;
import com.android.build.api.transform.TransformException;
import com.android.build.api.transform.TransformInput;
import com.android.build.api.transform.TransformInvocation;
import com.android.build.api.transform.TransformOutputProvider;
import com.android.build.gradle.internal.pipeline.TransformManager;
//import com.android.ide.common.internal.WaitableExecutor;
import com.android.ide.common.workers.WorkerExecutorFacade;
import com.ft.plugin.garble.FTExtension;
import com.ft.plugin.garble.Logger;
import com.ft.plugin.garble.bytecode.FTWeaver;
import com.google.common.io.Files;
import org.apache.commons.io.FileUtils;
import org.gradle.api.Project;
import java.io.File;
import java.io.IOException;
import java.net.URLClassLoader;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* From https://github.com/Leaking/Hunter/blob/master/hunter-transform/src/main/java/com/quinn/hunter/transform/HunterTransform.java
* DATE:2019-11-29 13:33
* Description:字节码转换基类
*/
public class FTTransform extends Transform {
private final Project project;
private final BaseWeaver bytecodeWeaver = new FTWeaver();
private final Worker waitableExecutor;
private static final int cpuCount = Runtime.getRuntime().availableProcessors();
private final static ExecutorService IO = new ThreadPoolExecutor(0, cpuCount * 3,
30L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>());
public FTTransform(Project project) {
this.project = project;
this.waitableExecutor = new Worker(IO) ;
}
@Override
public String getName() {
return this.getClass().getSimpleName();
}
@Override
public Set<QualifiedContent.ContentType> getInputTypes() {
return TransformManager.CONTENT_CLASS;
}
@Override
public Set<QualifiedContent.ScopeType> getScopes() {
return TransformManager.SCOPE_FULL_PROJECT;
}
@Override
public boolean isIncremental() {
return true;
}
@Override
public void transform(TransformInvocation transformInvocation) throws TransformException, InterruptedException, IOException {
FTExtension ftExtension = (FTExtension) project.getExtensions().getByName("FTExt");
if (ftExtension.openAutoTrack) {
transformFun(transformInvocation.getContext(),
transformInvocation.getInputs(),
transformInvocation.getReferencedInputs(),
transformInvocation.getOutputProvider(),
transformInvocation.isIncremental());
}
}
private void transformFun(Context context,
Collection<TransformInput> inputs,
Collection<TransformInput> referencedInputs,
TransformOutputProvider outputProvider,
boolean isIncremental) throws IOException, TransformException, InterruptedException {
Logger.debug(getName() + " isIncremental = " + isIncremental);
long startTime = System.currentTimeMillis();
if (!isIncremental) {
outputProvider.deleteAll();
}
URLClassLoader urlClassLoader = ClassLoaderHelper.getClassLoader(inputs, referencedInputs, project);
this.bytecodeWeaver.setClassLoader(urlClassLoader);
boolean flagForCleanDexBuilderFolder = false;
for (TransformInput input : inputs) {
for (JarInput jarInput : input.getJarInputs()) {
//logger.warn("jarInput.getFile().getAbsolutePath() = " + jarInput.getFile().getAbsolutePath());
Status status = jarInput.getStatus();
File dest = outputProvider.getContentLocation(
jarInput.getFile().getAbsolutePath(),
jarInput.getContentTypes(),
jarInput.getScopes(),
Format.JAR);
if (isIncremental) {
switch (status) {
case NOTCHANGED:
break;
case ADDED:
case CHANGED:
transformJar(jarInput.getFile(), dest, status);
break;
case REMOVED:
if (dest.exists()) {
FileUtils.forceDelete(dest);
}
break;
}
} else {
if (!isIncremental && !flagForCleanDexBuilderFolder) {
cleanDexBuilderFolder(dest);
flagForCleanDexBuilderFolder = true;
}
transformJar(jarInput.getFile(), dest, status);
}
}
for (DirectoryInput directoryInput : input.getDirectoryInputs()) {
File dest = outputProvider.getContentLocation(directoryInput.getName(),
directoryInput.getContentTypes(), directoryInput.getScopes(),
Format.DIRECTORY);
FileUtils.forceMkdir(dest);
if (isIncremental) {
String srcDirPath = directoryInput.getFile().getAbsolutePath();
String destDirPath = dest.getAbsolutePath();
Map<File, Status> fileStatusMap = directoryInput.getChangedFiles();
for (Map.Entry<File, Status> changedFile : fileStatusMap.entrySet()) {
Status status = changedFile.getValue();
File inputFile = changedFile.getKey();
String destFilePath = inputFile.getAbsolutePath().replace(srcDirPath, destDirPath);
File destFile = new File(destFilePath);
switch (status) {
case NOTCHANGED:
break;
case REMOVED:
if (destFile.exists()) {
//noinspection ResultOfMethodCallIgnored
destFile.delete();
}
break;
case ADDED:
case CHANGED:
try {
FileUtils.touch(destFile);
} catch (IOException e) {
//maybe mkdirs fail for some strange reason, try again.
Files.createParentDirs(destFile);
}
transformSingleFile(inputFile, destFile, srcDirPath);
break;
}
}
} else {
transformDir(directoryInput.getFile(), dest);
}
}
}
waitableExecutor.await();
long costTime = System.currentTimeMillis() - startTime;
Logger.debug((getName() + " cost " + costTime + "ms"));
}
private void transformSingleFile(final File inputFile, final File outputFile, final String srcBaseDir) {
waitableExecutor.submit(() -> {
bytecodeWeaver.weaveSingleClassToFile(inputFile, outputFile, srcBaseDir);
return null;
});
}
private void transformDir(final File inputDir, final File outputDir) throws IOException {
final String inputDirPath = inputDir.getAbsolutePath();
final String outputDirPath = outputDir.getAbsolutePath();
if (inputDir.isDirectory()) {
for (final File file : com.android.utils.FileUtils.getAllFiles(inputDir)) {
waitableExecutor.submit(() -> {
String filePath = file.getAbsolutePath();
File outputFile = new File(filePath.replace(inputDirPath, outputDirPath));
try {
bytecodeWeaver.weaveSingleClassToFile(file, outputFile, inputDirPath);
} catch (Exception e) {
Logger.debug("修改类异常-文件名:" + filePath + "----异常原因:" + e);
throw e;
}
return null;
});
}
}
}
private void transformJar(final File srcJar, final File destJar, Status status) {
waitableExecutor.submit(() -> {
bytecodeWeaver.weaveJar(srcJar, destJar);
return null;
});
}
private void cleanDexBuilderFolder(File dest) {
waitableExecutor.submit(() -> {
try {
String dexBuilderDir = replaceLastPart(dest.getAbsolutePath(), getName(), "dexBuilder");
//intermediates/transforms/dexBuilder/debug
File file = new File(dexBuilderDir).getParentFile();
project.getLogger().warn("clean dexBuilder folder = " + file.getAbsolutePath());
if (file.exists() && file.isDirectory()) {
com.android.utils.FileUtils.deleteDirectoryContents(file);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
});
}
private String replaceLastPart(String originString, String replacement, String toreplace) {
int start = originString.lastIndexOf(replacement);
StringBuilder builder = new StringBuilder();
builder.append(originString.substring(0, start));
builder.append(toreplace);
builder.append(originString.substring(start + replacement.length()));
return builder.toString();
}
@Override
public boolean isCacheable() {
return true;
}
}
| 42.028226 | 132 | 0.577569 |
265dafa62389c65edfe04732775eb98c58240059 | 20,753 | java | Java | modules/lwjgl/zstd/src/generated/java/org/lwjgl/util/zstd/ZDICTFastCoverParams.java | ralf1307/lwjgl3 | 343524d81004331ae54a9d26b38632b16279b261 | [
"BSD-3-Clause"
] | 2 | 2021-11-08T02:57:16.000Z | 2021-11-08T09:40:38.000Z | modules/lwjgl/zstd/src/generated/java/org/lwjgl/util/zstd/ZDICTFastCoverParams.java | ralf1307/lwjgl3 | 343524d81004331ae54a9d26b38632b16279b261 | [
"BSD-3-Clause"
] | null | null | null | modules/lwjgl/zstd/src/generated/java/org/lwjgl/util/zstd/ZDICTFastCoverParams.java | ralf1307/lwjgl3 | 343524d81004331ae54a9d26b38632b16279b261 | [
"BSD-3-Clause"
] | 1 | 2021-06-26T10:52:28.000Z | 2021-06-26T10:52:28.000Z | /*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.util.zstd;
import javax.annotation.*;
import java.nio.*;
import org.lwjgl.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;
/**
* {@code k} and {@code d} are the only required parameters. For others, value 0 means default.
*
* <h3>Layout</h3>
*
* <pre><code>
* struct ZDICT_fastCover_params_t {
* unsigned {@link #k};
* unsigned {@link #d};
* unsigned {@link #f};
* unsigned {@link #steps};
* unsigned {@link #nbThreads};
* double {@link #splitPoint};
* unsigned {@link #accel};
* {@link ZDICTParams ZDICT_params_t} zParams;
* }</code></pre>
*/
@NativeType("struct ZDICT_fastCover_params_t")
public class ZDICTFastCoverParams extends Struct implements NativeResource {
/** The struct size in bytes. */
public static final int SIZEOF;
/** The struct alignment in bytes. */
public static final int ALIGNOF;
/** The struct member offsets. */
public static final int
K,
D,
F,
STEPS,
NBTHREADS,
SPLITPOINT,
ACCEL,
ZPARAMS;
static {
Layout layout = __struct(
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(8),
__member(4),
__member(ZDICTParams.SIZEOF, ZDICTParams.ALIGNOF)
);
SIZEOF = layout.getSize();
ALIGNOF = layout.getAlignment();
K = layout.offsetof(0);
D = layout.offsetof(1);
F = layout.offsetof(2);
STEPS = layout.offsetof(3);
NBTHREADS = layout.offsetof(4);
SPLITPOINT = layout.offsetof(5);
ACCEL = layout.offsetof(6);
ZPARAMS = layout.offsetof(7);
}
/**
* Creates a {@code ZDICTFastCoverParams} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
* visible to the struct instance and vice versa.
*
* <p>The created instance holds a strong reference to the container object.</p>
*/
public ZDICTFastCoverParams(ByteBuffer container) {
super(memAddress(container), __checkContainer(container, SIZEOF));
}
@Override
public int sizeof() { return SIZEOF; }
/** segment size : constraint: {@code 0 < k} : Reasonable range {@code [16, 2048+]} */
@NativeType("unsigned")
public int k() { return nk(address()); }
/** {@code dmer} size : constraint: {@code 0 < d <= k} : Reasonable range {@code [6, 16]} */
@NativeType("unsigned")
public int d() { return nd(address()); }
/** log of size of frequency array : constraint: {@code 0 < f <= 31} : 1 means default(20) */
@NativeType("unsigned")
public int f() { return nf(address()); }
/** Number of steps : Only used for optimization : 0 means default (40) : Higher means more parameters checked */
@NativeType("unsigned")
public int steps() { return nsteps(address()); }
/**
* number of threads : constraint: {@code 0 < nbThreads} : 1 means single-threaded : Only used for optimization : Ignored if {@code ZSTD_MULTITHREAD} is
* not defined.
*/
@NativeType("unsigned")
public int nbThreads() { return nnbThreads(address()); }
/**
* percentage of samples used for training: Only used for optimization: the first {@code nbSamples * splitPoint} samples will be used to training, the
* last {@code nbSamples * (1 - splitPoint)} samples will be used for testing, 0 means default (0.75), 1.0 when all samples are used for both training and
* testing.
*/
public double splitPoint() { return nsplitPoint(address()); }
/** acceleration level: constraint: {@code 0 < accel <= 10}, higher means faster and less accurate, 0 means default(1) */
@NativeType("unsigned")
public int accel() { return naccel(address()); }
/** @return a {@link ZDICTParams} view of the {@code zParams} field. */
@NativeType("ZDICT_params_t")
public ZDICTParams zParams() { return nzParams(address()); }
/** Sets the specified value to the {@link #k} field. */
public ZDICTFastCoverParams k(@NativeType("unsigned") int value) { nk(address(), value); return this; }
/** Sets the specified value to the {@link #d} field. */
public ZDICTFastCoverParams d(@NativeType("unsigned") int value) { nd(address(), value); return this; }
/** Sets the specified value to the {@link #f} field. */
public ZDICTFastCoverParams f(@NativeType("unsigned") int value) { nf(address(), value); return this; }
/** Sets the specified value to the {@link #steps} field. */
public ZDICTFastCoverParams steps(@NativeType("unsigned") int value) { nsteps(address(), value); return this; }
/** Sets the specified value to the {@link #nbThreads} field. */
public ZDICTFastCoverParams nbThreads(@NativeType("unsigned") int value) { nnbThreads(address(), value); return this; }
/** Sets the specified value to the {@link #splitPoint} field. */
public ZDICTFastCoverParams splitPoint(double value) { nsplitPoint(address(), value); return this; }
/** Sets the specified value to the {@link #accel} field. */
public ZDICTFastCoverParams accel(@NativeType("unsigned") int value) { naccel(address(), value); return this; }
/** Copies the specified {@link ZDICTParams} to the {@code zParams} field. */
public ZDICTFastCoverParams zParams(@NativeType("ZDICT_params_t") ZDICTParams value) { nzParams(address(), value); return this; }
/** Passes the {@code zParams} field to the specified {@link java.util.function.Consumer Consumer}. */
public ZDICTFastCoverParams zParams(java.util.function.Consumer<ZDICTParams> consumer) { consumer.accept(zParams()); return this; }
/** Initializes this struct with the specified values. */
public ZDICTFastCoverParams set(
int k,
int d,
int f,
int steps,
int nbThreads,
double splitPoint,
int accel,
ZDICTParams zParams
) {
k(k);
d(d);
f(f);
steps(steps);
nbThreads(nbThreads);
splitPoint(splitPoint);
accel(accel);
zParams(zParams);
return this;
}
/**
* Copies the specified struct data to this struct.
*
* @param src the source struct
*
* @return this struct
*/
public ZDICTFastCoverParams set(ZDICTFastCoverParams src) {
memCopy(src.address(), address(), SIZEOF);
return this;
}
// -----------------------------------
/** Returns a new {@code ZDICTFastCoverParams} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
public static ZDICTFastCoverParams malloc() {
return wrap(ZDICTFastCoverParams.class, nmemAllocChecked(SIZEOF));
}
/** Returns a new {@code ZDICTFastCoverParams} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
public static ZDICTFastCoverParams calloc() {
return wrap(ZDICTFastCoverParams.class, nmemCallocChecked(1, SIZEOF));
}
/** Returns a new {@code ZDICTFastCoverParams} instance allocated with {@link BufferUtils}. */
public static ZDICTFastCoverParams create() {
ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
return wrap(ZDICTFastCoverParams.class, memAddress(container), container);
}
/** Returns a new {@code ZDICTFastCoverParams} instance for the specified memory address. */
public static ZDICTFastCoverParams create(long address) {
return wrap(ZDICTFastCoverParams.class, address);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static ZDICTFastCoverParams createSafe(long address) {
return address == NULL ? null : wrap(ZDICTFastCoverParams.class, address);
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer malloc(int capacity) {
return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer calloc(int capacity) {
return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated with {@link BufferUtils}.
*
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer create(int capacity) {
ByteBuffer container = __create(capacity, SIZEOF);
return wrap(Buffer.class, memAddress(container), capacity, container);
}
/**
* Create a {@link ZDICTFastCoverParams.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer create(long address, int capacity) {
return wrap(Buffer.class, address, capacity);
}
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static ZDICTFastCoverParams.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : wrap(Buffer.class, address, capacity);
}
// -----------------------------------
/** Returns a new {@code ZDICTFastCoverParams} instance allocated on the thread-local {@link MemoryStack}. */
public static ZDICTFastCoverParams mallocStack() {
return mallocStack(stackGet());
}
/** Returns a new {@code ZDICTFastCoverParams} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
public static ZDICTFastCoverParams callocStack() {
return callocStack(stackGet());
}
/**
* Returns a new {@code ZDICTFastCoverParams} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static ZDICTFastCoverParams mallocStack(MemoryStack stack) {
return wrap(ZDICTFastCoverParams.class, stack.nmalloc(ALIGNOF, SIZEOF));
}
/**
* Returns a new {@code ZDICTFastCoverParams} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static ZDICTFastCoverParams callocStack(MemoryStack stack) {
return wrap(ZDICTFastCoverParams.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated on the thread-local {@link MemoryStack}.
*
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer mallocStack(int capacity) {
return mallocStack(capacity, stackGet());
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
*
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer callocStack(int capacity) {
return callocStack(capacity, stackGet());
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer mallocStack(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link ZDICTFastCoverParams.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static ZDICTFastCoverParams.Buffer callocStack(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
}
// -----------------------------------
/** Unsafe version of {@link #k}. */
public static int nk(long struct) { return UNSAFE.getInt(null, struct + ZDICTFastCoverParams.K); }
/** Unsafe version of {@link #d}. */
public static int nd(long struct) { return UNSAFE.getInt(null, struct + ZDICTFastCoverParams.D); }
/** Unsafe version of {@link #f}. */
public static int nf(long struct) { return UNSAFE.getInt(null, struct + ZDICTFastCoverParams.F); }
/** Unsafe version of {@link #steps}. */
public static int nsteps(long struct) { return UNSAFE.getInt(null, struct + ZDICTFastCoverParams.STEPS); }
/** Unsafe version of {@link #nbThreads}. */
public static int nnbThreads(long struct) { return UNSAFE.getInt(null, struct + ZDICTFastCoverParams.NBTHREADS); }
/** Unsafe version of {@link #splitPoint}. */
public static double nsplitPoint(long struct) { return UNSAFE.getDouble(null, struct + ZDICTFastCoverParams.SPLITPOINT); }
/** Unsafe version of {@link #accel}. */
public static int naccel(long struct) { return UNSAFE.getInt(null, struct + ZDICTFastCoverParams.ACCEL); }
/** Unsafe version of {@link #zParams}. */
public static ZDICTParams nzParams(long struct) { return ZDICTParams.create(struct + ZDICTFastCoverParams.ZPARAMS); }
/** Unsafe version of {@link #k(int) k}. */
public static void nk(long struct, int value) { UNSAFE.putInt(null, struct + ZDICTFastCoverParams.K, value); }
/** Unsafe version of {@link #d(int) d}. */
public static void nd(long struct, int value) { UNSAFE.putInt(null, struct + ZDICTFastCoverParams.D, value); }
/** Unsafe version of {@link #f(int) f}. */
public static void nf(long struct, int value) { UNSAFE.putInt(null, struct + ZDICTFastCoverParams.F, value); }
/** Unsafe version of {@link #steps(int) steps}. */
public static void nsteps(long struct, int value) { UNSAFE.putInt(null, struct + ZDICTFastCoverParams.STEPS, value); }
/** Unsafe version of {@link #nbThreads(int) nbThreads}. */
public static void nnbThreads(long struct, int value) { UNSAFE.putInt(null, struct + ZDICTFastCoverParams.NBTHREADS, value); }
/** Unsafe version of {@link #splitPoint(double) splitPoint}. */
public static void nsplitPoint(long struct, double value) { UNSAFE.putDouble(null, struct + ZDICTFastCoverParams.SPLITPOINT, value); }
/** Unsafe version of {@link #accel(int) accel}. */
public static void naccel(long struct, int value) { UNSAFE.putInt(null, struct + ZDICTFastCoverParams.ACCEL, value); }
/** Unsafe version of {@link #zParams(ZDICTParams) zParams}. */
public static void nzParams(long struct, ZDICTParams value) { memCopy(value.address(), struct + ZDICTFastCoverParams.ZPARAMS, ZDICTParams.SIZEOF); }
// -----------------------------------
/** An array of {@link ZDICTFastCoverParams} structs. */
public static class Buffer extends StructBuffer<ZDICTFastCoverParams, Buffer> implements NativeResource {
private static final ZDICTFastCoverParams ELEMENT_FACTORY = ZDICTFastCoverParams.create(-1L);
/**
* Creates a new {@code ZDICTFastCoverParams.Buffer} instance backed by the specified container.
*
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
* by {@link ZDICTFastCoverParams#SIZEOF}, and its mark will be undefined.
*
* <p>The created buffer instance holds a strong reference to the container object.</p>
*/
public Buffer(ByteBuffer container) {
super(container, container.remaining() / SIZEOF);
}
public Buffer(long address, int cap) {
super(address, null, -1, 0, cap, cap);
}
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
super(address, container, mark, pos, lim, cap);
}
@Override
protected Buffer self() {
return this;
}
@Override
protected ZDICTFastCoverParams getElementFactory() {
return ELEMENT_FACTORY;
}
/** @return the value of the {@link ZDICTFastCoverParams#k} field. */
@NativeType("unsigned")
public int k() { return ZDICTFastCoverParams.nk(address()); }
/** @return the value of the {@link ZDICTFastCoverParams#d} field. */
@NativeType("unsigned")
public int d() { return ZDICTFastCoverParams.nd(address()); }
/** @return the value of the {@link ZDICTFastCoverParams#f} field. */
@NativeType("unsigned")
public int f() { return ZDICTFastCoverParams.nf(address()); }
/** @return the value of the {@link ZDICTFastCoverParams#steps} field. */
@NativeType("unsigned")
public int steps() { return ZDICTFastCoverParams.nsteps(address()); }
/** @return the value of the {@link ZDICTFastCoverParams#nbThreads} field. */
@NativeType("unsigned")
public int nbThreads() { return ZDICTFastCoverParams.nnbThreads(address()); }
/** @return the value of the {@link ZDICTFastCoverParams#splitPoint} field. */
public double splitPoint() { return ZDICTFastCoverParams.nsplitPoint(address()); }
/** @return the value of the {@link ZDICTFastCoverParams#accel} field. */
@NativeType("unsigned")
public int accel() { return ZDICTFastCoverParams.naccel(address()); }
/** @return a {@link ZDICTParams} view of the {@code zParams} field. */
@NativeType("ZDICT_params_t")
public ZDICTParams zParams() { return ZDICTFastCoverParams.nzParams(address()); }
/** Sets the specified value to the {@link ZDICTFastCoverParams#k} field. */
public ZDICTFastCoverParams.Buffer k(@NativeType("unsigned") int value) { ZDICTFastCoverParams.nk(address(), value); return this; }
/** Sets the specified value to the {@link ZDICTFastCoverParams#d} field. */
public ZDICTFastCoverParams.Buffer d(@NativeType("unsigned") int value) { ZDICTFastCoverParams.nd(address(), value); return this; }
/** Sets the specified value to the {@link ZDICTFastCoverParams#f} field. */
public ZDICTFastCoverParams.Buffer f(@NativeType("unsigned") int value) { ZDICTFastCoverParams.nf(address(), value); return this; }
/** Sets the specified value to the {@link ZDICTFastCoverParams#steps} field. */
public ZDICTFastCoverParams.Buffer steps(@NativeType("unsigned") int value) { ZDICTFastCoverParams.nsteps(address(), value); return this; }
/** Sets the specified value to the {@link ZDICTFastCoverParams#nbThreads} field. */
public ZDICTFastCoverParams.Buffer nbThreads(@NativeType("unsigned") int value) { ZDICTFastCoverParams.nnbThreads(address(), value); return this; }
/** Sets the specified value to the {@link ZDICTFastCoverParams#splitPoint} field. */
public ZDICTFastCoverParams.Buffer splitPoint(double value) { ZDICTFastCoverParams.nsplitPoint(address(), value); return this; }
/** Sets the specified value to the {@link ZDICTFastCoverParams#accel} field. */
public ZDICTFastCoverParams.Buffer accel(@NativeType("unsigned") int value) { ZDICTFastCoverParams.naccel(address(), value); return this; }
/** Copies the specified {@link ZDICTParams} to the {@code zParams} field. */
public ZDICTFastCoverParams.Buffer zParams(@NativeType("ZDICT_params_t") ZDICTParams value) { ZDICTFastCoverParams.nzParams(address(), value); return this; }
/** Passes the {@code zParams} field to the specified {@link java.util.function.Consumer Consumer}. */
public ZDICTFastCoverParams.Buffer zParams(java.util.function.Consumer<ZDICTParams> consumer) { consumer.accept(zParams()); return this; }
}
} | 47.381279 | 165 | 0.66535 |
61f09d935dcb56c90b8449fe7d1987899e39020b | 112 | sql | SQL | src/server/migrations/2019-09-03-154728_alter_position_task_id_uniqueness_constraint_for_steps_table/down.sql | blendle/automaat | 437cab1b5b6d5c03775d375fbff2989c55eaad28 | [
"Apache-2.0",
"MIT"
] | 10 | 2019-06-10T11:46:11.000Z | 2020-12-01T22:55:26.000Z | src/server/migrations/2019-09-03-154728_alter_position_task_id_uniqueness_constraint_for_steps_table/down.sql | JeanMertz/automaat | 437cab1b5b6d5c03775d375fbff2989c55eaad28 | [
"Apache-2.0",
"MIT"
] | 61 | 2019-06-06T09:37:25.000Z | 2019-11-27T12:00:49.000Z | src/server/migrations/2019-09-03-154728_alter_position_task_id_uniqueness_constraint_for_steps_table/down.sql | JeanMertz/automaat | 437cab1b5b6d5c03775d375fbff2989c55eaad28 | [
"Apache-2.0",
"MIT"
] | 3 | 2019-07-27T23:41:31.000Z | 2020-07-05T23:49:19.000Z | ALTER TABLE steps DROP CONSTRAINT steps_position_task_id_key;
ALTER TABLE steps ADD UNIQUE (position, task_id);
| 37.333333 | 61 | 0.839286 |
4ad6b02d49c7aa58b91e70eaca2058dd5cb16adc | 7,454 | cs | C# | src/Core/RNG1998.cs | Hoishin/RNGHelper | c63d1239d233b27f1853311bc24dc1526ecce0e7 | [
"MIT"
] | 3 | 2019-05-25T18:22:41.000Z | 2021-07-11T12:00:57.000Z | src/Core/RNG1998.cs | dnasdw/RNGHelper | 461008ecf67a57eb4dc2b6e149136ca33ff53deb | [
"MIT"
] | 13 | 2017-07-22T00:31:56.000Z | 2017-08-27T10:04:44.000Z | src/Core/RNG1998.cs | dnasdw/RNGHelper | 461008ecf67a57eb4dc2b6e149136ca33ff53deb | [
"MIT"
] | 6 | 2017-07-21T21:02:37.000Z | 2017-09-20T14:50:23.000Z | /* C# Port of MT19937: Integer version (1998/4/6) algorithm used in the PS2. */
/* More information, including original source can be found at the following */
/* Link: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/C-LANG/ver980409.html */
/* A C-program for MT19937: Integer version (1998/4/6) */
/* genrand() generates one pseudorandom unsigned integer (32bit) */
/* which is uniformly distributed among 0 to 2^32-1 for each */
/* call. sgenrand(seed) set initial values to the working area */
/* of 624 words. Before genrand(), sgenrand(seed) must be */
/* called once. (seed is any 32-bit integer except for 0). */
/* Coded by Takuji Nishimura, considering the suggestions by */
/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Library General Public */
/* License as published by the Free Software Foundation; either */
/* version 2 of the License, or (at your option) any later */
/* version. */
/* This library 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 Library General Public License for more details. */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */
/* 02111-1307 USA */
/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */
/* When you use this, send an email to: matumoto@math.keio.ac.jp */
/* with an appropriate reference to your work. */
/* REFERENCE */
/* M. Matsumoto and T. Nishimura, */
/* "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform */
/* Pseudo-Random Number Generator", */
/* ACM Transactions on Modeling and Computer Simulation, */
/* Vol. 8, No. 1, January 1998, pp 3--30. */
using System;
namespace FF12RNGHelper.Core
{
public class RNG1998 : IRNG
{
/// <summary>
/// This is the seed the PS2 uses.
/// </summary>
private const UInt32 DEFAULT_SEED = 4537U; //For original implementation, default seed is 4357
/// <summary>
/// Period Parameters.
/// </summary>
private const int M = 397;
private const int N = 624;
private const UInt32 MATRIX_A = 0x9908b0dfU; // constant Vector a
private const UInt32 UPPER_MASK = 0x80000000U; // Most significant w-r bits
private const UInt32 LOWER_MASK = 0x7fffffffU; // Least significant r bits
/// <summary>
/// Tempering parameters.
/// </summary>
private const UInt32 TEMPERING_MASK_B = 0x9d2c5680U;
private const UInt32 TEMPERING_MASK_C = 0xefc60000U;
/// <summary>
/// The array for the state vector.
/// </summary>
private UInt32[] mt = new UInt32[N];
/// <summary>
/// mt's index used in for loops. A value of N+1 means mt[N] is not initialized.
/// </summary>
private int mti = N+1;
private int position = 0; // for debugging purpoes;
private UInt32[] mag01 = { 0x0, MATRIX_A };
public RNG1998(UInt32 seed = DEFAULT_SEED)
{
sgenrand(seed);
}
public void sgenrand()
{
sgenrand(DEFAULT_SEED);
}
/// <summary>
/// Seeds the random number generator and restarts the sequence.
/// </summary>
/// <param name="seed">The Seed used for determining the sequence.</param>
public void sgenrand(UInt32 seed)
{
/* setting initial seeds to mt[N] using */
/* the generator Line 25 of Table 1 in */
/* [KNUTH 1981, The Art of Computer Programming */
/* Vol. 2 (2nd Ed.), pp102] */
mt[0] = seed & 0xffffffff;
for (mti=1; mti<N; mti++)
{
mt[mti] = (69069 * mt[mti - 1]) & 0xffffffff;
}
position = 0;
}
/// <summary>
/// Generates the next random number in the sequence
/// on [0,0xffffffff]-interval.
/// </summary>
/// <returns>The next random number in the sequence.</returns>
public UInt32 genrand()
{
int kk;
UInt32 y = 0;
if(mti >= N)
{
if (mti == N + 1) sgenrand(DEFAULT_SEED);
for(kk=0; kk < N-M; kk++)
{
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
mt[kk] = mt[kk + M] ^ (y >> 1) ^ mag01[y & 0x1];
}
for (; kk < N - 1; kk++)
{
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ mag01[y & 0x1];
}
y = (mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
mt[N - 1] = mt[M - 1] ^ (y >> 1) ^ mag01[y & 0x1];
mti = 0;
}
y = mt[mti++];
y ^= y >> 11;
y ^= y << 7 & TEMPERING_MASK_B;
y ^= y << 15 & TEMPERING_MASK_C;
y ^= y >> 18;
position++;
return y;
}
/// <summary>
/// Saves the state of the RNG
/// </summary>
/// <param name="rng"></param>
/// <returns>RNGState structure</returns>
public RNGState saveState()
{
return new RNGState
{
mti = this.mti,
mt = this.mt.Clone() as uint[],
position = this.position
};
}
/// <summary>
/// Loads the state of the RNG
/// </summary>
/// <param name="inmti">Input mti</param>
/// <param name="inmt">Input mt</param>
public void loadState(int mti, UInt32[] mt, int position)
{
this.mti = mti;
mt.CopyTo(this.mt, 0);
this.position = position;
}
/// <summary>
/// Loads the state of the RNG
/// </summary>
/// <param name="inputState">Tuple<Input mti, Input mt, Input mag01></param>
public void loadState(RNGState inputState)
{
mti = inputState.mti;
inputState.mt.CopyTo(mt, 0);
position = inputState.position;
}
/// <summary>
/// Return a deep copy
/// </summary>
public IRNG DeepClone()
{
RNG1998 newRNG = new RNG1998();
newRNG.loadState(saveState());
return newRNG;
}
/// <summary>
/// return a deep copy
/// </summary>
object IDeepCloneable.DeepClone()
{
return DeepClone();
}
public int getPosition()
{
return position;
}
}
}
| 35.836538 | 102 | 0.500939 |
7ea5ead6197f3f0f54a4359c34ac5e56291c5ab5 | 928 | asm | Assembly | programs/oeis/096/A096145.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/096/A096145.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/096/A096145.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A096145: Sum of digits in Pascal's triangle (A007318) in decimal representation, triangle read by rows, 0<=k<=n.
; 1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,1,5,1,1,5,1,1,6,6,2,6,6,1,1,7,3,8,8,3,7,1,1,8,10,11,7,11,10,8,1,1,9,9,12,9,9,12,9,9,1,1,1,9,3,3,9,3,3,9,1,1,1,2,10,12,6,12,12,6,12,10,2,1,1,3,12,4,18,18,15,18,18,4,12,3,1,1,4,15,16,13,18,15,15,18,13,16,15,4,1,1,5,10,13,2,4,6,12,6,4,2,13,10,5,1,1,6,6,14,15,6,10,18,18,10,6,15,14,6,6,1,1,7,3,11,11,21,16,10,18,10,16,21,11,11,3,7,1,1,8,10,14,13,23,19,26,10,10,26,19,23,13,14,10,8,1,1,9,9,15,9,27,24,18,27,20,27,18,24,27,9,15,9,9,1,1,10,9,24,24,18,15,24,27,29,29,27,24,15,18,24,24,9,10,1,1,2,10,6,21,15,24,21,24,29,31,29,24,21,24,15,21,6,10,2,1,1,3,3,7,27,18,21,18,18,26,24,24,26,18,18,21,18,27,7
cal $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n.
cal $0,7953 ; Digital sum (i.e., sum of digits) of n; also called digsum(n).
mov $1,$0
| 132.571429 | 624 | 0.612069 |
fb9e9a092431d4d731854ef8ba7690f9af06b100 | 4,631 | java | Java | arrival_backend/src/main/java/com/arrival/selenium/server/Hub.java | aaronTecDevTest/arrival-octo | 0b0500d7801112799092f95a066f9e1a31df0afa | [
"Apache-2.0"
] | null | null | null | arrival_backend/src/main/java/com/arrival/selenium/server/Hub.java | aaronTecDevTest/arrival-octo | 0b0500d7801112799092f95a066f9e1a31df0afa | [
"Apache-2.0"
] | null | null | null | arrival_backend/src/main/java/com/arrival/selenium/server/Hub.java | aaronTecDevTest/arrival-octo | 0b0500d7801112799092f95a066f9e1a31df0afa | [
"Apache-2.0"
] | null | null | null | package com.arrival.selenium.server;
/**
* @author Aaron Kutekidila
* @version 1.0
* Created on 31.05.2015.
* @since 1.0
* <p/>
* <P>Hub</P>
* This Class return a instance of SeleniumHub.
* Also can start, stop and restart the Hub.
*/
import com.arrival.utilities.SystemPreferences;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.grid.internal.utils.GridHubConfiguration;
public class Hub {
private static final Logger log = LogManager.getLogger(Hub.class.getName());
private static final String HUBHOST = "127.0.0.1";
private static final Integer HUBPORT = 4444;
/**
* @param osName: Operation-System Name like "Mac OS", "Windows xxx" or "Linux xx"
*/
private String osName;
/**
* @param gridHubConfig: @see GridHubConfiguration
*/
private GridHubConfiguration gridHubConfig;
/**
* @param hub: @see org.openqa.grid.web.Hub
*/
private org.openqa.grid.web.Hub hub;
/**
* @param hubHost: Hostname oder IP-Address where to run the SeleniumHub
*/
private String hubHost;
/**
* @param hubHost: Port where to run the SeleniumHub
*/
private int hubPort;
/**
* Standard construct to ini gridHubConfig, hubHost, hubPort and
* osName.
*/
public Hub() {
gridHubConfig = new GridHubConfiguration();
hubHost = HUBHOST;
hubPort = HUBPORT;
osName = SystemPreferences.getOsName();
setUpHub();
log.info("SeleniumHub created");
}
/**
* Construct with ini parameter
*
* @param host @see hubHost
* @param port @see hubPort
*/
public Hub(String host, String port) {
gridHubConfig = new GridHubConfiguration();
hubHost = host;
hubPort = Integer.valueOf(port);
osName = SystemPreferences.getOsName();
setUpHub();
log.info("SeleniumHub created");
}
/*public static void main(String[] args) {
Hub hubNode = new Hub("127.0.0.1","4444");
hubNode.startHub();
// hubNode.shutDownNodeAndHub();
//hubNode.stopHub();
}*/
/**
* Setup the Hub with GridHubConfig
*/
private void setUpHub() {
try {
gridHubConfig.setHost(java.lang.String.valueOf(hubHost));
gridHubConfig.setPort(hubPort);
gridHubConfig.setTimeout(600000);
hub = new org.openqa.grid.web.Hub(gridHubConfig);
} catch (Exception e) {
log.error(e.getStackTrace());
}
}
/**
* Start the hub with configured Host and Post
*/
public void startHub() {
try {
/* if (hub != null) {
hub.stop();
}*/
setUpHub();
hub.start();
log.info("Start the hub on: " + hubHost + " on port: " + hubPort + " successful!");
} catch (Exception e) {
log.error("Fail to start the hub on: " + hubHost + " on port: " + hubPort + ". " + e.getMessage());
}
}
/**
* Stop the hub on configured Host and Post
*/
public void stopHub() {
try {
hub.stop();
log.info("Stop the hub on: " + hubHost + " on port: " + hubPort + " successful!");
} catch (Exception e) {
log.error("Fail to stop the hub on: " + hubHost + " on port: " + hubPort);
}
}
/**
* Restart the hub with configured/reset Host and Post
*/
public void restartHub() {
try {
hub.stop();
hub.start();
log.info("Restart the hub on: " + hubHost + " on port: " + hubPort);
} catch (Exception e) {
log.error("Fail to restart the hub on: " + hubHost + " on port: " + hubPort);
}
}
public String getOsName() {
return osName;
}
public void setOsName(String osName) {
this.osName = osName;
}
public GridHubConfiguration getGridHubConfig() {
return gridHubConfig;
}
public void setGridHubConfig(GridHubConfiguration gridHubConfig) {
this.gridHubConfig = gridHubConfig;
}
public org.openqa.grid.web.Hub getHub() {
return hub;
}
public void setHub(org.openqa.grid.web.Hub hub) {
this.hub = hub;
}
public String getHubHost() {
return hubHost;
}
public void setHubHost(String hubHost) {
this.hubHost = hubHost;
}
public Integer getHubPort() {
return hubPort;
}
public void setHubPort(Integer hubPort) {
this.hubPort = hubPort;
}
}
| 25.871508 | 111 | 0.571799 |
9bc44693db72228f199071925840d3b1cb7f9bda | 483 | js | JavaScript | src/app/header/header.js | merlinwarage/anytalk-web | 7fd9c8c9c536ba2a6aee1b198276a0a518a89e62 | [
"MIT"
] | 2 | 2018-05-27T07:13:34.000Z | 2021-07-18T19:00:15.000Z | src/app/header/header.js | merlinwarage/anytalk-web | 7fd9c8c9c536ba2a6aee1b198276a0a518a89e62 | [
"MIT"
] | 3 | 2020-09-04T14:59:50.000Z | 2021-05-06T23:31:00.000Z | src/app/header/header.js | merlinwarage/anytalk-web | 7fd9c8c9c536ba2a6aee1b198276a0a518a89e62 | [
"MIT"
] | null | null | null | (function (angular) {
angular.module('appModule').directive('header', ["$location", "GlobalConstants",
function ($location, GlobalConstants) {
return {
templateUrl: GlobalConstants.states.header.TPL,
restrict: 'E',
replace: true,
link: function (scope, element, attrs) {
scope.buildInfo = attrs.buildInfo;
}
};
}]);
})(window.angular);
| 28.411765 | 84 | 0.503106 |
0d0dd238a2b5a4649c1b6f0b04cfcc6226ba2ef5 | 230 | sql | SQL | sql/create/controlselect.sql | pathooverjr/grids | 9a09420142e680788dffad85337190151ee78a76 | [
"MIT"
] | null | null | null | sql/create/controlselect.sql | pathooverjr/grids | 9a09420142e680788dffad85337190151ee78a76 | [
"MIT"
] | null | null | null | sql/create/controlselect.sql | pathooverjr/grids | 9a09420142e680788dffad85337190151ee78a76 | [
"MIT"
] | null | null | null | CREATE TABLE "controlselect" (
"xid" INTEGER NOT NULL,
"displayorder" INTEGER,
"type" TEXT,
"context" TEXT DEFAULT 'grid',
"active" INTEGER DEFAULT 1,
"createdon" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY("xid")
) | 25.555556 | 52 | 0.721739 |
19f9a3483d2c2de77ba6154f9032b28b568d40e0 | 20,889 | lua | Lua | examples/collisions.lua | stetre/moonode | 05ff397dfcf1300910b0c2cd726c5e3f4a389a93 | [
"MIT"
] | null | null | null | examples/collisions.lua | stetre/moonode | 05ff397dfcf1300910b0c2cd726c5e3f4a389a93 | [
"MIT"
] | null | null | null | examples/collisions.lua | stetre/moonode | 05ff397dfcf1300910b0c2cd726c5e3f4a389a93 | [
"MIT"
] | null | null | null | #!/usr/bin/env lua
-- MoonODE collision tests.
-- Derived from ode/demo/demo_collisions.cpp
local ode = require("moonode")
local glmath = require("moonglmath")
ode.glmath_compat(true)
local TOL = 1e-8 -- tolerance used for numerical checks
local vec3, mat3, mat4 = glmath.vec3, glmath.mat3, glmath.mat4
local pi, cos, sin = math.pi, math.cos, math.sin
local abs, sqrt = math.abs, math.sqrt
local random, randomf, randomsign = ode.random, ode.randomf, ode.randomsign
local randomdir, randomvec3, randomrot = ode.randomdir, ode.randomvec3, ode.randomrot
local function printf(...) io.write(string.format(...)) end
local COUNTER = {} -- COUNTER[i] = no of failures for test #i
local function RESET() COUNTER = {} end
local function FAILED(i) COUNTER[i] = COUNTER[i] and COUNTER[i]+1 or 1 end
math.randomseed(os.time())
-------------------------------------------------------------------------------
-- Point depth tests
-------------------------------------------------------------------------------
local function test_sphere_point_depth()
local space = ode.create_simple_space()
local sphere = ode.create_sphere(nil, 1)
space:add(sphere)
-- make a random sphere
local r = random()+.1
local C = randomvec3(1.0)
sphere:set_radius(r)
sphere:set_position(C)
sphere:set_rotation(randomrot())
-- test that center point has depth r
if abs(sphere:point_depth(C) - r) > TOL then FAILED(1) end
-- test that point on surface has depth 0
local P = C + r*randomdir()
if abs(sphere:point_depth(P)) > TOL then FAILED(2) end
-- test point at random depth
local d = (randomf(-1, 1))*r
local P = C + (r-d)*randomdir()
if abs(sphere:point_depth(P) - d) > TOL then FAILED(3) end
end
local function test_box_point_depth()
local space = ode.create_simple_space()
local box = ode.create_box(nil, 1, 1, 1)
space:add(box)
-- make a random box
local s = vec3(random()+.1, random()+.1, random()+.1)
local C = randomvec3(1.0)
box:set_lengths(s.x, s.y, s.z)
box:set_position(C)
box:set_rotation(randomrot())
-- test that center point depth is half of smallest side
local ss = math.min(s.x, s.y, s.z) -- smallest side
if abs(box:point_depth(C) -ss/2) > TOL then FAILED(1) end
-- test that points on surface have depth 0
local P = vec3(randomf(-.5, .5)*s.x,
randomf(-.5, .5)*s.y,
randomf(-.5, .5)*s.z)
local i = random(1, 3)
P[i] = randomsign()*s[i]*0.5
P = C + box:get_rotation()*P
if abs(box:point_depth(P)) > TOL then FAILED(2) end
-- test that points outside the box have negative depth
local P = vec3(randomsign()*(s.x/2+random()+.01),
randomsign()*(s.y/2+random()+.01),
randomsign()*(s.z/2+random()+.01))
P = C + box:get_rotation()*P
if box:point_depth(P)>= 0 then FAILED(3) end
-- test that points inside the box have positive depth
local P = vec3(s.x*.99*randomf(-.5, .5),
s.y*.99*randomf(-.5, .5),
s.z*.99*randomf(-.5, .5))
P = C + box:get_rotation()*P
if box:point_depth(P) <= 0 then FAILED(4) end
-- test depth of point aligned along axis (up to smallest-side-deep)
local d = random()*(ss/2 + 1) - 1
local P = vec3()
local i = random(1, 3)
P[i] = randomsign()*(s[i]/2 - d)
P = C + box:get_rotation()*P
if abs(box:point_depth(P) -d) >= TOL then FAILED(5) end
end
local function test_capsule_point_depth()
local space = ode.create_simple_space()
local capsule = ode.create_capsule(nil, 1, 1)
space:add(capsule)
-- make a random capsule
local r = .5*random()+.01
local l = random()+ .01
local C = randomvec3(1.0)
capsule:set(r, l)
capsule:set_position(C)
capsule:set_rotation(randomrot())
-- test that point on axis has depth equal to radius
local P = randomf(-.5, .5)*l*vec3(0, 0, 1)
P = C + capsule:get_rotation()*P
if abs(capsule:point_depth(P) - r) >= TOL then FAILED(1) end
-- test that a point on the surface (excluding caps) has depth 0
local beta = randomf(0, 2*pi)
local P = vec3(r*sin(beta), r*cos(beta), randomf(-.5,.5)*l)
P = C + capsule:get_rotation()*P
if abs(capsule:point_depth(P)) > TOL then FAILED(2) end
-- test that a point on a surface of a cap has depth 0
local dir = randomdir()
local zofs = vec3(0, 0, l/2)
if dir * vec3(0, 0, 1) < 0 then zofs = -zofs end
local P = C + capsule:get_rotation()*(zofs + r*dir)
if abs(capsule:point_depth(P)) > TOL then FAILED(3) end
-- test that a point inside the capsule has positive depth
local P = C + capsule:get_rotation()*(zofs + .99*r*dir)
if capsule:point_depth(P) < 0 then FAILED(4) end
-- test point depth of a point inside the cylinder
local beta = randomf(0, 2*pi)
local d = randomf(-1, 1)*r
local P = vec3((r-d)*sin(beta), (r-d)*cos(beta), l*randomf(-.5, .5))
P = C + capsule:get_rotation()*P
if abs(capsule:point_depth(P) -d) >= TOL then FAILED(5) end
-- test point depth of a point inside a cap
local d = randomf(-1, 1)*r
local dir = randomdir()
local zofs = vec3(0, 0, l/2)
if dir * vec3(0, 0, 1) < 0 then zofs = -zofs end
local P = C + capsule:get_rotation()*(zofs + (r-d)*dir)
if abs(capsule:point_depth(P) -d) > TOL then FAILED(6) end
end
local function test_plane_point_depth()
local space = ode.create_simple_space()
local plane = ode.create_plane(nil, 0, 0, 1, 0)
space:add(plane)
-- make a random plane
local n = randomdir() -- plane normal
local d = randomf(-.5, .5)
plane:set(n.x, n.y, n.z, d) -- plane equation: n·(x, y, z) = d
local n, p, q = plane:basis()
-- test that a point on the plane has depth 0
local P = d*n + randomf()*p + randomf()*q
if abs(plane:point_depth(P)) >= TOL then FAILED(1) end
-- test the depth of a random point
local x = randomf(-.5, 5)
local y = randomf(-.5, 5)
local z = randomf(-.5, 5)
local P = x*p + y*q + (d+z)*n
-- if z > 0 then depth is negative, if z < 0 then depth is positive
-- |z| is the distance from the plane, so the depth is -z
if abs(plane:point_depth(P) + z) >= TOL then FAILED(2) end
-- test that the depth of a point with depth=1 is actually 1
local x = randomf(-.5, 5)
local y = randomf(-.5, 5)
local P = x*p + y*q + (d-1)*n
if abs(plane:point_depth(P) -1) >= TOL then FAILED(3) end
end
-------------------------------------------------------------------------------
-- Ray tests
-------------------------------------------------------------------------------
local function test_ray_and_sphere()
local space = ode.create_simple_space()
local ray = ode.create_ray(nil, 0)
local sphere = ode.create_sphere(nil, 1)
space:add(ray)
space:add(sphere)
-- make random sphere
local r = randomf()+.1
local C = randomvec3(1.0)
sphere:set_radius(r)
sphere:set_position(C)
sphere:set_rotation(randomrot())
-- test zero length ray just inside sphere
local P = C + .99*r*randomdir()
ray:set_length(0)
ray:set_position(P)
randomrot()
ray:set_rotation(randomrot())
if ode.collide(ray, sphere, 1) then FAILED(1) end
-- test zero length ray just outside sphere
local P = C + 1.01*r*randomdir()
ray:set_length(0)
ray:set_position(P)
ray:set_rotation(randomrot())
if ode.collide(ray, sphere, 1) then FAILED(2) end
-- test a finite length ray totally inside the sphere
local P = C + 0.99*r*randomdir()
local Q = C + 0.99*r*randomdir()
local dir = (Q-P):normalize()
ray:set(P, dir)
ray:set_length((Q-P):norm())
if ode.collide(ray, sphere, 1) then FAILED(3) end
-- test a finite length ray totally outside the sphere
local P = C + 1.01*r*randomdir()
local n = (P-C)
local dir
repeat dir = randomdir() until dir*n > 0 -- make sure it points away from the sphere
ray:set(P, dir)
ray:set_length(100)
if ode.collide(ray, sphere, 1) then FAILED(4) end
-- test ray from outside to just above surface
local dir = randomdir()
local P = C - 2*r*dir
ray:set(P, dir)
ray:set_length(.99*r)
if ode.collide(ray, sphere, 1) then FAILED(5) end
-- test ray from outside to just below surface
ray:set_length(1.001*r)
if not ode.collide(ray, sphere, 2) then FAILED(6) end
-- test contact point distance for random rays
local P = C + randomf(0.5, 1.5)*r*randomdir()
local dir = randomdir()
ray:set(P, dir)
ray:set_length(100)
local collide, contacts = ode.collide(ray, sphere, 1)
if collide then
local contact = contacts[1]
-- check that the contact point is on the sphere
local d = (contact.position - C):norm()
if abs(d-r) > TOL then FAILED(7) end
-- check the sign of the normal
if contact.normal * dir > 0 then FAILED(8) end
-- check the depth of the contact point
if abs(sphere:point_depth(contact.position)) > TOL then FAILED(9) end
end
-- test tangential grazing - miss
local n = randomdir()
local dir, _ = ode.plane_basis(n)
local P = C + 1.0001*r*n - dir
ray:set(P, dir)
ray:set_length(2)
if ode.collide(ray, sphere, 1) then FAILED(9) end
-- test tangential grazing - hit
local n = randomdir()
local dir, _ = ode.plane_basis(n)
local P = C + 0.99*r*n - dir
ray:set(P, dir)
ray:set_length(2)
if not ode.collide(ray, sphere, 1) then FAILED(10) end
end
local function test_ray_and_box()
local space = ode.create_simple_space()
local ray = ode.create_ray(nil, 0)
local box = ode.create_box(nil, 1, 1, 1)
space:add(ray)
space:add(box)
-- make a random box
local s = vec3(random()+.1, random()+.1, random()+.1)
local C = randomvec3(1.0)
box:set_lengths(s.x, s.y, s.z)
box:set_position(C)
box:set_rotation(randomrot())
-- test a zero length ray just inside the box
ray:set_length(0)
local dir = vec3(randomf(-.5, .5)*s.x, randomf(-.5, .5)*s.y, randomf(-.5, .5)*s.z)
local i = random(1, 3)
dir[i] = randomsign()*.99*.5*s[i]
local P = C + box:get_rotation()*dir
ray:set_position(P)
ray:set_rotation(randomrot())
if ode.collide(ray, box, 1) then FAILED(1) end
-- test a zero length ray just outside the box
ray:set_length(0)
local dir = vec3(randomf(-.5, .5)*s.x, randomf(-.5, .5)*s.y, randomf(-.5, .5)*s.z)
local i = random(1, 3)
dir[i] = randomsign()*.99*.5*s[i]
local P = C + box:get_rotation()*dir
ray:set_position(P)
ray:set_rotation(randomrot())
if ode.collide(ray, box, 1) then FAILED(2) end
-- test a finite length ray totally contained inside the box
local dir = vec3(randomf(-.5, .5)*s.x, randomf(-.5, .5)*s.y, randomf(-.5, .5)*s.z)*.99
local P = C + box:get_rotation()*dir
local dir = vec3(randomf(-.5, .5)*s.x, randomf(-.5, .5)*s.y, randomf(-.5, .5)*s.z)*.99
local Q = C + box:get_rotation()*dir
ray:set(P, (Q-P):normalize())
ray:set_length((Q-P):norm())
if ode.collide(ray, box, 1) then FAILED(3) end
-- test finite length ray totally outside the box
local dir = vec3(randomf(-.5, .5)*s.x, randomf(-.5, .5)*s.y, randomf(-.5, .5)*s.z)
local i = random(1, 3)
dir[i] = randomsign()*1.01*.5*s[i]
dir = box:get_rotation()*dir
local P = C + dir
ray:set(P, dir:normalize())
ray:set_length(10)
if ode.collide(ray, box, 1) then FAILED(4) end
-- test ray from outside to just above surface
local dir = vec3(randomf(-.5, .5)*s.x, randomf(-.5, .5)*s.y, randomf(-.5, .5)*s.z)
local i = random(1, 3)
dir[i] = randomsign()*1.01*.5*s[i]
dir = box:get_rotation()*dir
local P =
ray:set(C + 2*dir, -(dir:normalize()))
ray:set_length(dir:norm()*.99)
if ode.collide(ray, box, 1) then FAILED(5) end
-- test ray from outside to just below surface
ray:set_length(dir:norm()*1.01)
if not ode.collide(ray, box, 1) then FAILED(6) end
-- test contact point position for random rays
local P = C + box:get_rotation()*vec3(randomf()*s.x, randomf()*s.y, randomf()*s.z)
local dir = randomdir()
ray:set(P, dir)
ray:set_length(10)
local collide, contacts = ode.collide(ray, box, 1)
if collide then
local contact = contacts[1]
-- check depth of contact point
if abs(box:point_depth(contact.position)) > TOL then FAILED(7) end
-- check position of contact point
local Q = box:get_rotation()*(contact.position - C) -- to box space
if abs(abs(Q.x) - s.x/2) > TOL
or abs(abs(Q.y) - s.y/2) > TOL
or abs(abs(Q.z) - s.z/2) > TOL
then FAILED(8)
end
-- check normal signs
if dir*contact.normal > 9 then FAILED(9) end
end
end
local function test_ray_and_capsule()
local space = ode.create_simple_space()
local ray = ode.create_ray(nil, 0)
local capsule = ode.create_capsule(nil, 1, 1)
space:add(ray)
space:add(capsule)
-- make a random capsule
local r = randomf()/2 + .01
local l = randomf() + .01
capsule:set(r, l)
local C = randomvec3()
capsule:set_position(C)
local rot = randomrot()
capsule:set_rotation(rot)
local zaxis = rot:column(3)
-- test ray completely within capsule
local k = l*randomf(-.5, .5)
local P = C + .99*k*zaxis + .99*r*randomdir() -- point in the cap
local Q = C + .99*k*zaxis + .99*r*randomdir()
ray:set_length((Q-P):norm())
ray:set(P, (Q-P):normalize())
if ode.collide(ray, capsule, 1) then FAILED(1) end
-- test ray outside capsule that just misses (between caps)
local n
repeat n = randomdir() until n*zaxis > 0 -- normal to a cap
local P = C + l/2*rot*vec3(0,0,1) + 2*r*n -- outside point at distance r from the cap
ray:set(P, -n:normalize())
ray:set_length(.99*r)
if ode.collide(ray, capsule, 1) then FAILED(2) end
-- test ray outside capsule that just hits (between caps)
ray:set_length(1.01*r)
local collide, contacts = ode.collide(ray, capsule, 1)
if not collide then FAILED(3) end
-- also check the depth of the contact point
if abs(capsule:point_depth(contacts[1].position)) > TOL then FAILED(4) end
-- test ray outside capsule that just misses (caps)
local n
repeat n = randomdir() until n*zaxis > 0
local dir, _ = ode.plane_basis(n)
local P = C + l/2*rot*vec3(0,0,1) + 1.0001*r*n -- point just outside the cap
ray:set(P-5*dir, dir)
ray:set_length(10)
if ode.collide(ray, capsule, 1) then FAILED(5) end
-- test ray outside capsule that just hits (caps)
local P = C + l/2*rot*vec3(0,0,1) + .99*r*n -- point just outside the cap
ray:set(P-5*dir, dir)
ray:set_length(10)
local collide, contacts = ode.collide(ray, capsule, 1)
if not collide then FAILED(6) end
-- also check the depth of the contact point
if abs(capsule:point_depth(contacts[1].position)) > TOL then FAILED(7) end
-- test random rays
local P = randomvec3()
local dir = randomdir()
ray:set(P, dir)
ray:set_length(10)
local collide, contacts = ode.collide(ray, capsule, 1)
if collide then
local contact = contacts[1]
-- check depth of contact point
if abs(capsule:point_depth(contact.position)) > TOL then FAILED(8) end
-- check normal signs
if dir*contact.normal > 0 then FAILED(9) end
end
end
local function test_ray_and_cylinder()
local space = ode.create_simple_space()
local ray = ode.create_ray(nil, 0)
local cylinder = ode.create_cylinder(nil, 0, 0)
space:add(ray)
space:add(cylinder)
-- make random cylinder
local r = randomf()+.1
local l = randomf()+.1
local C = randomvec3()
local rot = randomrot()
local xaxis, yaxis, zaxis = rot:column(1), rot:column(2), rot:column(3)
cylinder:set(r, l)
cylinder:set_position(C)
cylinder:set_rotation(rot)
-- test inside ray that just misses the side
local dir = (randomf()*xaxis + randomf()*yaxis):normalize()
local P = C + l*randomf(-.5,.5)*zaxis + (r-.02)*dir
ray:set(P, dir)
ray:set_length(.01)
if ode.collide(ray, cylinder, 1) then FAILED(1) end
-- test inside ray that just hits the side
ray:set_length(.03)
if not ode.collide(ray, cylinder, 1) then FAILED(2) end
local collide, contacts = ode.collide(ray, cylinder, 1)
if collide then
local contact = contacts[1]
-- there is no cylinder:point_depth() method.
-- check normal signs
if dir*contact.normal > 0 then FAILED(3) end
end
-- test outside ray that just misses the side
local dir = (randomf()*xaxis + randomf()*yaxis):normalize()
local P = C + l*randomf(-.5,.5)*zaxis + (r+.02)*dir
ray:set(P, -dir)
ray:set_length(.01)
if ode.collide(ray, cylinder, 1) then FAILED(4) end
-- test outside ray that just hits the side
ray:set_length(.03)
if not ode.collide(ray, cylinder, 1) then FAILED(2) end
local collide, contacts = ode.collide(ray, cylinder, 1)
if collide then
local contact = contacts[1]
-- there is no cylinder:point_depth() method.
-- check normal signs
if dir*contact.normal < 0 then FAILED(3) end
end
-- test inside ray that just misses the top or bottom
local dir = (randomf()*xaxis + randomf()*yaxis):normalize()
local P = C + (l/2-.02)*zaxis + (r-.02)*dir
ray:set(P, zaxis)
ray:set_length(.01)
if ode.collide(ray, cylinder, 1) then FAILED(4) end
-- test inside ray that just hits the top or bottom
ray:set_length(.03)
if not ode.collide(ray, cylinder, 1) then FAILED(5) end
local collide, contacts = ode.collide(ray, cylinder, 1)
if collide then
local contact = contacts[1]
-- there is no cylinder:point_depth() method.
-- check normal signs
if zaxis*contact.normal > 0 then FAILED(6) end
end
-- test outside ray that just misses the top or bottom
local dir = (randomf()*xaxis + randomf()*yaxis):normalize()
local P = C + (l/2+.02)*zaxis + (r-.02)*dir
ray:set(P, -zaxis)
ray:set_length(.01)
if ode.collide(ray, cylinder, 1) then FAILED(7) end
-- test inside ray that just hits the top or bottom
ray:set_length(.03)
if not ode.collide(ray, cylinder, 1) then FAILED(8) end
local collide, contacts = ode.collide(ray, cylinder, 1)
if collide then
local contact = contacts[1]
-- there is no cylinder:point_depth() method.
-- check normal signs
if zaxis*contact.normal < 0 then FAILED(9) end
end
end
local function test_ray_and_plane()
local space = ode.create_simple_space()
local ray = ode.create_ray(nil, 0)
local plane = ode.create_plane(nil, 0, 0, 1, 0)
space:add(ray)
space:add(plane)
-- make a random plane
local n = randomdir()
local d = randomf()
plane:set(n.x, n.y, n.z, d)
local _, p, q = plane:basis()
-- test finite length ray below plane (miss)
local P = p*randomf(-.5, .5) + q*randomf(-.5, .5) + n*(d-.1)
ray:set(P, n)
ray:set_length(0.09)
if ode.collide(ray, plane, 1) then FAILED(1) end
-- test finite length ray below plane (hit)
ray:set_length(0.11)
local collide, contacts = ode.collide(ray, plane, 1)
if not collide then
FAILED(2)
else -- test contact point depth and contact normal
if abs(plane:point_depth(contacts[1].position)) > TOL then FAILED(3) end
if n*contacts[1].normal > 0 then FAILED(4) end
end
-- test finite length ray above plane (miss)
local P = p*randomf(-.5, .5) + q*randomf(-.5, .5) + n*(d+.1)
ray:set(P, -n)
ray:set_length(0.09)
if ode.collide(ray, plane, 1) then FAILED(5) end
-- test finite length ray above plane (hit)
ray:set_length(0.11)
local collide, contacts = ode.collide(ray, plane, 1)
if not collide then
FAILED(6)
else -- test contact point depth and normal sign
if abs(plane:point_depth(contacts[1].position)) > TOL then FAILED(7) end
if n*contacts[1].normal < 0 then FAILED(8) end
end
end
-------------------------------------------------------------------------------
-- Run tests
-------------------------------------------------------------------------------
local function run_test(name, testfunc, N)
RESET()
for i = 1, N do testfunc() end
local none = "none"
printf("%s - %d tests, failed: ", name, N)
for i, c in pairs(COUNTER) do
none=""
printf("test %d (%.1f%%) ", i, c/N*100)
end
printf("%s\n", none)
end
local N = 1000
run_test(" sphere_point_depth", test_sphere_point_depth, N)
run_test(" box_point_depth", test_box_point_depth, N)
run_test("capsule_point_depth", test_capsule_point_depth, N)
run_test(" plane_point_depth", test_plane_point_depth, N)
run_test(" ray_and_sphere", test_ray_and_sphere, N)
run_test(" ray_and_box", test_ray_and_box, N)
run_test(" ray_and_capsule", test_ray_and_capsule, N)
run_test(" ray_and_cylinder", test_ray_and_cylinder, N)
run_test(" ray_and_plane", test_ray_and_plane, N)
-- @@ There could be some problem in box:point_depth() (i.e. dGeomBoxPointDepth())
-- because also the original tests involving this function fail.
| 37.842391 | 89 | 0.627316 |
f143629f42f01a46bb099a4aa13eaa885f526992 | 1,363 | lua | Lua | Interface/AddOns/DBM-Party-WoD/Auchindoun/AuchTrash.lua | YellowDi/Tristram | 13c6f1f48e6440055f5e284c03d948882b9db6cd | [
"MIT"
] | null | null | null | Interface/AddOns/DBM-Party-WoD/Auchindoun/AuchTrash.lua | YellowDi/Tristram | 13c6f1f48e6440055f5e284c03d948882b9db6cd | [
"MIT"
] | null | null | null | Interface/AddOns/DBM-Party-WoD/Auchindoun/AuchTrash.lua | YellowDi/Tristram | 13c6f1f48e6440055f5e284c03d948882b9db6cd | [
"MIT"
] | 1 | 2021-06-22T17:25:11.000Z | 2021-06-22T17:25:11.000Z | local mod = DBM:NewMod("AuchTrash", "DBM-Party-WoD", 1)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 13843 $"):sub(12, -3))
--mod:SetModelID(47785)
mod:SetZone()
mod.isTrashMod = true
mod:RegisterEvents(
-- "SPELL_AURA_APPLIED",
"SPELL_CAST_START 157173 157797 154527 154623 160312"
)
local warnVoidShell = mod:NewSpellAnnounce(160312, 3)
local specWarnBendWill = mod:NewSpecialWarningInterrupt(154527)
local specWarnVoidShell = mod:NewSpecialWarningDispel(160312, "MagicDispeller")
local specWarnVoidMending = mod:NewSpecialWarningInterrupt(154623)
local specWarnFelStomp = mod:NewSpecialWarningDodge(157173, "Tank")
local specWarnArbitersHammer = mod:NewSpecialWarningInterrupt(157797)
mod:RemoveOption("HealthFrame")
function mod:SPELL_CAST_START(args)
if not self.Options.Enabled or self:IsDifficulty("normal5") then return end
local spellId = args.spellId
if spellId == 157173 then
specWarnFelStomp:Show()
elseif spellId == 157797 then
specWarnArbitersHammer:Show(args.sourceName)
elseif spellId == 154527 then
specWarnBendWill:Show(args.sourceName)
elseif spellId == 154623 then
specWarnVoidMending:Show(args.sourceName)
elseif spellId == 160312 then
warnVoidShell:Schedule(2)
specWarnVoidShell:Schedule(2, SPELL_TARGET_TYPE13_DESC)--"enemies"
end
end
| 33.243902 | 83 | 0.761555 |
8191a48c69dfc040ffcf53dac83adb6e9175adcf | 2,933 | go | Go | api/packet.go | cyucelen/wirect | 9e5c185561426e0c617ba003b840f7298d84399e | [
"MIT"
] | 5 | 2019-04-15T14:42:44.000Z | 2019-06-13T13:47:43.000Z | api/packet.go | cyucelen/wirect | 9e5c185561426e0c617ba003b840f7298d84399e | [
"MIT"
] | null | null | null | api/packet.go | cyucelen/wirect | 9e5c185561426e0c617ba003b840f7298d84399e | [
"MIT"
] | null | null | null | package api
import (
"errors"
"net/http"
"net/url"
"github.com/labstack/echo"
"github.com/cyucelen/wirect/model"
)
type PacketDatabase interface {
CreatePacket(packet *model.Packet) error
GetPacketsBySniffer(snifferMAC string) []model.Packet
GetPacketsBySnifferSince(snifferMAC string, since int64) []model.Packet
GetPacketsBySnifferBetweenDates(snifferMAC string, from, until int64) []model.Packet
GetUniqueMACCountBySnifferBetweenDates(snifferMAC string, from, until int64) int
}
type PacketAPI struct {
DB PacketDatabase
}
func (p *PacketAPI) CreatePacket(ctx echo.Context) error {
var snifferPacket model.SnifferPacket
if err := ctx.Bind(&snifferPacket); err != nil {
ctx.JSON(http.StatusBadRequest, nil)
return err
}
if !isSnifferPacketValid(snifferPacket) {
ctx.JSON(http.StatusBadRequest, nil)
return errors.New("")
}
snifferMAC, err := getSnifferMAC(ctx)
if err != nil {
return err
}
packet := toPacket(&snifferPacket, snifferMAC)
if err := p.DB.CreatePacket(packet); err != nil {
ctx.JSON(http.StatusInternalServerError, nil)
return err
}
ctx.JSON(http.StatusCreated, snifferPacket)
return nil
}
func (p *PacketAPI) CreatePackets(ctx echo.Context) error {
var snifferPackets []model.SnifferPacket
if err := ctx.Bind(&snifferPackets); err != nil {
ctx.JSON(http.StatusBadRequest, "")
return err
}
validSnifferPackets := filterValidSnifferPackets(snifferPackets)
if len(validSnifferPackets) == 0 {
ctx.JSON(http.StatusBadRequest, nil)
return errors.New("")
}
snifferMAC, err := getSnifferMAC(ctx)
if err != nil {
return err
}
for _, validSnifferPacket := range validSnifferPackets {
packet := toPacket(&validSnifferPacket, snifferMAC)
if err := p.DB.CreatePacket(packet); err != nil {
ctx.JSON(http.StatusInternalServerError, nil)
return err
}
}
ctx.JSON(http.StatusCreated, snifferPackets)
return nil
}
func getSnifferMAC(ctx echo.Context) (string, error) {
snifferMAC, err := url.QueryUnescape(ctx.Param("snifferMAC"))
if err != nil {
ctx.JSON(http.StatusNotFound, nil)
return "", err
}
if snifferMAC == "" {
ctx.JSON(http.StatusNotFound, nil)
return "", errors.New("")
}
return snifferMAC, nil
}
func filterValidSnifferPackets(snifferPackets []model.SnifferPacket) []model.SnifferPacket {
validSnifferPackets := []model.SnifferPacket{}
for _, snifferPacket := range snifferPackets {
if isSnifferPacketValid(snifferPacket) {
validSnifferPackets = append(validSnifferPackets, snifferPacket)
}
}
return validSnifferPackets
}
func isSnifferPacketValid(snifferPacket model.SnifferPacket) bool {
return snifferPacket.MAC != "" && snifferPacket.Timestamp != 0
}
func toPacket(snifferPacket *model.SnifferPacket, snifferMAC string) *model.Packet {
return &model.Packet{
MAC: snifferPacket.MAC,
Timestamp: snifferPacket.Timestamp,
RSSI: snifferPacket.RSSI,
SnifferMAC: snifferMAC,
}
}
| 24.040984 | 92 | 0.738152 |
02d9a67cba9617640db7e827a61dcd9c35a981e1 | 698 | asm | Assembly | src/call_on_stack-msvc-win32.asm | qgymib/call_on_stack | 33243364ee08c9916b610436c3cc811941201c39 | [
"MIT"
] | null | null | null | src/call_on_stack-msvc-win32.asm | qgymib/call_on_stack | 33243364ee08c9916b610436c3cc811941201c39 | [
"MIT"
] | null | null | null | src/call_on_stack-msvc-win32.asm | qgymib/call_on_stack | 33243364ee08c9916b610436c3cc811941201c39 | [
"MIT"
] | null | null | null | .model flat
.code
_call_on_stack__asm PROC
push ebp
mov ebp, esp
sub esp, 8h
; backup callee saved registers
push esi
push edi
; backup stack
mov esi, esp
mov edi, ebp
; get func and arg
mov eax, DWORD PTR 12[ebp]
mov ecx, DWORD PTR 16[ebp]
; switch stack
mov esp, DWORD PTR 8[ebp]
mov ebp, esp
; func(arg)
push ecx
call eax
; restore stack
mov esp, esi
mov ebp, edi
; restore callee saved registers
pop edi
pop esi
; leave
add esp, 8h
pop ebp
ret
_call_on_stack__asm ENDP
END
| 19.942857 | 37 | 0.510029 |
bccfede5238c0862efe155cc63bb5fb54968c328 | 1,705 | js | JavaScript | node_modules/vant-weapp/lib/mixins/safe-area.js | pang9988/xiangshui | 4dc448a0b90468e14d1b32995f653f3a2ad6f2e1 | [
"MIT"
] | 12 | 2019-07-08T02:42:39.000Z | 2022-03-10T10:10:42.000Z | node_modules/vant-weapp/lib/mixins/safe-area.js | pang9988/xiangshui | 4dc448a0b90468e14d1b32995f653f3a2ad6f2e1 | [
"MIT"
] | 4 | 2020-07-17T16:18:12.000Z | 2022-03-24T06:27:55.000Z | node_modules/vant-weapp/lib/mixins/safe-area.js | pang9988/xiangshui | 4dc448a0b90468e14d1b32995f653f3a2ad6f2e1 | [
"MIT"
] | 13 | 2019-07-10T14:50:26.000Z | 2022-03-04T01:47:44.000Z | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var cache = null;
function getSafeArea() {
return new Promise(function (resolve, reject) {
if (cache != null) {
resolve(cache);
}
else {
wx.getSystemInfo({
success: function (_a) {
var model = _a.model, screenHeight = _a.screenHeight, statusBarHeight = _a.statusBarHeight;
var iphoneX = /iphone x/i.test(model);
var iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
cache = {
isIPhoneX: iphoneX || iphoneNew,
statusBarHeight: statusBarHeight
};
resolve(cache);
},
fail: reject
});
}
});
}
exports.safeArea = function (_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.safeAreaInsetBottom, safeAreaInsetBottom = _c === void 0 ? true : _c, _d = _b.safeAreaInsetTop, safeAreaInsetTop = _d === void 0 ? false : _d;
return Behavior({
properties: {
safeAreaInsetTop: {
type: Boolean,
value: safeAreaInsetTop
},
safeAreaInsetBottom: {
type: Boolean,
value: safeAreaInsetBottom
}
},
created: function () {
var _this = this;
getSafeArea().then(function (_a) {
var isIPhoneX = _a.isIPhoneX, statusBarHeight = _a.statusBarHeight;
_this.set({ isIPhoneX: isIPhoneX, statusBarHeight: statusBarHeight });
});
}
});
};
| 35.520833 | 188 | 0.493842 |
8080305fd05afb67f889f2d721457c6b09978104 | 327 | java | Java | agent/src/main/java/com/ppaass/agent/IAgentResourceManager.java | quhxuxm/ppaass-java | 29de34192e6b584b733f07186417cb60761354f4 | [
"Apache-2.0"
] | null | null | null | agent/src/main/java/com/ppaass/agent/IAgentResourceManager.java | quhxuxm/ppaass-java | 29de34192e6b584b733f07186417cb60761354f4 | [
"Apache-2.0"
] | null | null | null | agent/src/main/java/com/ppaass/agent/IAgentResourceManager.java | quhxuxm/ppaass-java | 29de34192e6b584b733f07186417cb60761354f4 | [
"Apache-2.0"
] | null | null | null | package com.ppaass.agent;
/**
* The agent resource manager.
*/
public interface IAgentResourceManager {
/**
* Prepare the resource that an agent requires for running.
*/
void prepareResources();
/**
* Destroy the resource that a agent requires for running.
*/
void destroyResources();
}
| 19.235294 | 63 | 0.651376 |
49ab4a86f8bd040cc6929889041512feefe880c1 | 185 | html | HTML | chrome/test/data/navigation_predictor/page_with_same_host_anchor_element.html | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | chrome/test/data/navigation_predictor/page_with_same_host_anchor_element.html | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | chrome/test/data/navigation_predictor/page_with_same_host_anchor_element.html | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | <html>
<head>
</head>
<body>
<a id="google" href="https://google.com">Google</a>
<a id="example" href="iframe_simple_page_with_anchors.html">Example</a>
</body>
</html>
| 20.555556 | 75 | 0.621622 |
bca5255448f23cd7f46ac4c3e0b29f80d8fe9206 | 839 | js | JavaScript | app.js | pythondevop12/videochat | bc601645a21f78c303e4294890e6df16d422f27a | [
"MIT"
] | null | null | null | app.js | pythondevop12/videochat | bc601645a21f78c303e4294890e6df16d422f27a | [
"MIT"
] | null | null | null | app.js | pythondevop12/videochat | bc601645a21f78c303e4294890e6df16d422f27a | [
"MIT"
] | null | null | null | const express = require("express");
const app = express();
const http = require("http");
const hostname = "localhost";
const port = process.env.PORT || 3000;
const server = http.createServer(app);
const stream = require("./ws/stream");
const io = require("socket.io")(server);
const path = require("path");
const favicon = require("serve-favicon");
app.use(favicon(path.join(__dirname, "favicon.ico")));
app.use("/assets", express.static(path.join(__dirname, "assets")));
app.get("/", (req, res) => {
res.sendFile(__dirname + "/index.html");
});
server.listen(port, hostname, function (err) {
if (err) {
throw err;
}
console.log("server listening on: ", hostname, ":", port);
});
io.of("/stream").on("connection", stream);
//console.log("Express server listening on port %d", server.address().port);
//server.listen(3031);
| 28.931034 | 76 | 0.668653 |
5bfe6ea4e7aab2c5c9fbf2af1ac413f1a76a1c8f | 853 | sql | SQL | test/fixtures/project/data/sql/schema.sql | ahonnecke/tjSolrDoctrineBehaviorPlugin | 60cadd8e5a6d0743c6e30513f8aaa4381635546d | [
"MIT"
] | 2 | 2015-10-22T14:33:24.000Z | 2018-03-25T01:47:03.000Z | test/fixtures/project/data/sql/schema.sql | ahonnecke/tjSolrDoctrineBehaviorPlugin | 60cadd8e5a6d0743c6e30513f8aaa4381635546d | [
"MIT"
] | null | null | null | test/fixtures/project/data/sql/schema.sql | ahonnecke/tjSolrDoctrineBehaviorPlugin | 60cadd8e5a6d0743c6e30513f8aaa4381635546d | [
"MIT"
] | 1 | 2015-01-15T23:36:04.000Z | 2015-01-15T23:36:04.000Z | CREATE TABLE post (id BIGINT AUTO_INCREMENT, thread_id BIGINT NOT NULL, title VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX thread_id_idx (thread_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE story_translation (id BIGINT, body LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) ENGINE = INNODB;
CREATE TABLE story (id BIGINT AUTO_INCREMENT, slug VARCHAR(50), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE thread (id BIGINT AUTO_INCREMENT, title VARCHAR(255) NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
ALTER TABLE post ADD CONSTRAINT post_thread_id_thread_id FOREIGN KEY (thread_id) REFERENCES thread(id) ON DELETE CASCADE;
ALTER TABLE story_translation ADD CONSTRAINT story_translation_id_story_id FOREIGN KEY (id) REFERENCES story(id) ON UPDATE CASCADE ON DELETE CASCADE;
| 121.857143 | 251 | 0.801876 |
13514b2bf31a6950293eb948b0fc31cb7adbab07 | 919 | c | C | runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/common/time.c | vschiavoni/unine-twine | 312d770585ea88c13ef135ef467fee779494fd90 | [
"Apache-2.0"
] | 20 | 2021-04-05T20:05:57.000Z | 2022-02-19T18:48:52.000Z | runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/common/time.c | vschiavoni/unine-twine | 312d770585ea88c13ef135ef467fee779494fd90 | [
"Apache-2.0"
] | null | null | null | runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/common/time.c | vschiavoni/unine-twine | 312d770585ea88c13ef135ef467fee779494fd90 | [
"Apache-2.0"
] | 4 | 2021-02-22T14:52:21.000Z | 2022-01-10T16:58:39.000Z | #include "common/time.h"
// Converts a CloudABI clock identifier to a POSIX clock identifier.
bool convert_clockid(
__wasi_clockid_t in,
clockid_t *out
) {
switch (in) {
case __WASI_CLOCK_MONOTONIC:
*out = CLOCK_MONOTONIC;
return true;
case __WASI_CLOCK_PROCESS_CPUTIME_ID:
*out = CLOCK_PROCESS_CPUTIME_ID;
return true;
case __WASI_CLOCK_REALTIME:
*out = CLOCK_REALTIME;
return true;
case __WASI_CLOCK_THREAD_CPUTIME_ID:
*out = CLOCK_THREAD_CPUTIME_ID;
return true;
default:
return false;
}
}
// Converts a POSIX timespec to a CloudABI timestamp.
__wasi_timestamp_t convert_timespec(
const struct timespec *ts
) {
if (ts->tv_sec < 0)
return 0;
if ((__wasi_timestamp_t)ts->tv_sec >= UINT64_MAX / 1000000000)
return UINT64_MAX;
return (__wasi_timestamp_t)ts->tv_sec * 1000000000 + (__wasi_timestamp_t)ts->tv_nsec;
} | 26.257143 | 87 | 0.700762 |
fe1b557664bc6e8bffa5b789e38c5e1ed474cc2a | 3,583 | hpp | C++ | src/distributed_join.hpp | rapidsai/distributed-join | 26e84fee80539d998bd8d788e44801b1c012879b | [
"Apache-2.0"
] | 17 | 2019-12-17T22:41:22.000Z | 2021-11-09T20:16:13.000Z | src/distributed_join.hpp | rapidsai/distributed-join | 26e84fee80539d998bd8d788e44801b1c012879b | [
"Apache-2.0"
] | 36 | 2019-12-18T14:59:36.000Z | 2021-08-23T05:32:05.000Z | src/distributed_join.hpp | rapidsai/distributed-join | 26e84fee80539d998bd8d788e44801b1c012879b | [
"Apache-2.0"
] | 10 | 2019-12-27T03:55:42.000Z | 2021-10-11T21:57:34.000Z | /*
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
#pragma once
#include "communicator.hpp"
#include "compression.hpp"
#include <cudf/table/table.hpp>
#include <cudf/table/table_view.hpp>
#include <cudf/types.hpp>
#include <cstdint>
#include <memory>
#include <vector>
/**
* Top level interface for distributed inner join.
*
* This function should be called collectively by all processes in MPI_COMM_WORLD. All arguments
* are significant for all ranks.
*
* The argument `left` and `right` are the left table and the right table distributed on each
* rank. In other word, the left (right) table to be joined is the concatenation of `left`
* (`right`) on all ranks. If the whole tables reside on a single rank, you should use
* *distribute_table* to distribute the table before calling this function.
*
* @param[in] left The left table distributed on each rank.
* @param[in] right The right table distributed on each rank.
* @param[in] left_on The column indices from `left` to join on.
* The column from `left` indicated by `left_on[i]` will be compared against the column
* from `right` indicated by `right_on[i]`.
* @param[in] right_on The column indices from `right` to join on.
* The column from `right` indicated by `right_on[i]` will be compared against the column
* from `left` indicated by `left_on[i]`.
* @param[in] communicator An instance of `Communicator` used for communication.
* @param[in] left_compression_options Vector of length equal to the number of columns in *left*,
* indicating whether/how each column of the left table needs to be compressed before communication.
* @param[in] right_compression_options Vector of length equal to the number of columns in *right*,
* indicating whether/how each column of the right table needs to be compressed before
* communication.
* @param[in] over_decom_factor Over-decomposition factor used for overlapping computation and
* communication.
* @param[in] report_timing Whether collect and print timing.
* @param[in] preallocated_pinned_buffer Preallocated page-locked host buffer with size at least
* `mpi_size * sizeof(size_t)`, used for holding the compressed sizes.
* @return Result of joining `left` and `right` tables on the columns
* specified by `left_on` and `right_on`. The resulting table will be joined columns of
* `left(including common columns)+right(excluding common columns)`. The join result is the
* concatenation of the returned tables on all ranks.
*/
std::unique_ptr<cudf::table> distributed_inner_join(
cudf::table_view left,
cudf::table_view right,
std::vector<cudf::size_type> const &left_on,
std::vector<cudf::size_type> const &right_on,
Communicator *communicator,
std::vector<ColumnCompressionOptions> left_compression_options,
std::vector<ColumnCompressionOptions> right_compression_options,
int over_decom_factor = 1,
bool report_timing = false,
void *preallocated_pinned_buffer = nullptr,
int nvlink_domain_size = 1);
| 46.532468 | 100 | 0.749093 |
2f9403f6a14b0a89662e931cd27f74287b8e3de1 | 1,742 | dart | Dart | tutorial/lib/app/splash/base.dart | codelieche/flutterAction | e0e6f0b7d71bc9601dd5fdd90b8b308e929509dc | [
"MIT"
] | null | null | null | tutorial/lib/app/splash/base.dart | codelieche/flutterAction | e0e6f0b7d71bc9601dd5fdd90b8b308e929509dc | [
"MIT"
] | null | null | null | tutorial/lib/app/splash/base.dart | codelieche/flutterAction | e0e6f0b7d71bc9601dd5fdd90b8b308e929509dc | [
"MIT"
] | null | null | null | /**
* 基本的过渡页
*/
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
// 引入首页
import 'package:tutorial/app/pages/home.dart';
import '../variables.dart';
// app启动基本过渡页
class BaseSplashPage extends StatefulWidget {
@override
_BaseSplashPageState createState() => _BaseSplashPageState();
}
class _BaseSplashPageState extends State<BaseSplashPage> {
// 计时器
Timer _t;
// 初始化状态
@override
void initState() {
super.initState();
// 初始化定时器
_t = new Timer(const Duration(milliseconds: 2000), () {
// 2秒钟之后,跳转主页
print("Hello splash");
try {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) => AppHomePage(),
),
(route) => route == null);
} catch (e) {
print(e);
}
});
}
@override
void dispose() {
_t.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
// color: Color.fromRGBO(74, 144, 226, 1),
color: AppPrimaryColor,
child: Padding(
padding: EdgeInsets.only(top: 150),
child: Column(
children: [
Text("编程列车",
style: TextStyle(
fontSize: 36,
color: Colors.white,
fontWeight: FontWeight.w500)),
Container(
height: 10,
),
Text(
"flutter tutorial",
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: FontWeight.w400),
)
],
)),
);
}
}
| 22.623377 | 63 | 0.512055 |
d2c759440558f245f5c9aeed4fe92223cf1debba | 2,487 | php | PHP | vendor/kphoen/sms-sender-bundle/KPhoen/SmsSenderBundle/Tests/SmsSender/LoggableSmsSenderTest.php | khayat1996/pidev1 | 9c9fd12cd378cfebba5745b2610f7436b407cf8d | [
"MIT"
] | null | null | null | vendor/kphoen/sms-sender-bundle/KPhoen/SmsSenderBundle/Tests/SmsSender/LoggableSmsSenderTest.php | khayat1996/pidev1 | 9c9fd12cd378cfebba5745b2610f7436b407cf8d | [
"MIT"
] | 3 | 2021-05-10T22:40:24.000Z | 2022-02-10T20:44:06.000Z | vendor/kphoen/sms-sender-bundle/KPhoen/SmsSenderBundle/Tests/SmsSender/LoggableSmsSenderTest.php | khayat1996/pidev1 | 9c9fd12cd378cfebba5745b2610f7436b407cf8d | [
"MIT"
] | 1 | 2020-11-07T17:08:08.000Z | 2020-11-07T17:08:08.000Z | <?php
namespace KPhoen\SmsSenderBundle\Tests\SmsSender;
use SmsSender\Provider\DummyProvider;
use KPhoen\SmsSenderBundle\SmsSender\LoggableSmsSender;
/**
* @author Kévin Gomez <contact@kevingomez.fr>
*/
class LoggableSmsSenderTest extends \PHPUnit_Framework_TestCase
{
public function testSendLogsData()
{
$provider = $this->getMock('\SmsSender\Provider\DummyProvider');
$result = $this->getMock('\SmsSender\Result\ResultInterface');
// setup the sender
$sender = $this->getMock('\SmsSender\SmsSenderInterface', array('getProvider', 'send'));
$sender->expects($this->once())
->method('getProvider')
->will($this->returnValue($provider));
$sender->expects($this->once())
->method('send')
->with(
$this->equalTo('0642424242'),
$this->equalTo('content'),
$this->equalTo('originator')
)
->will($this->returnValue($result));
// setup the logger
$logger = $this->getMock('\KPhoen\SmsSenderBundle\Logger\SmsSenderLogger', array('logMessage'));
$logger->expects($this->once())
->method('logMessage')
->with(
$this->equalTo($result), // the exact result returned by the sender
$this->greaterThan(0), // duration
$this->stringContains('DummyProvider') // provider className
);
// setup the sender
$sender = new LoggableSmsSender($sender, $logger);
// and launch the test
$senderResult = $sender->send('0642424242', 'content', 'originator');
$this->assertSame($result, $senderResult);
}
public function testSendWithNoLogger()
{
$result = $this->getMock('\SmsSender\Result\ResultInterface');
// setup the sender
$sender = $this->getMock('\SmsSender\SmsSender');
$sender->expects($this->once())
->method('send')
->with(
$this->equalTo('0642424242'),
$this->equalTo('content'),
$this->equalTo('originator')
)
->will($this->returnValue($result));
// setup the sender
$sender = new LoggableSmsSender($sender);
// and launch the test
$senderResult = $sender->send('0642424242', 'content', 'originator');
$this->assertSame($result, $senderResult);
}
}
| 33.608108 | 104 | 0.56534 |
da6b5229354a1a529174a43b85422406f3700538 | 43 | dart | Dart | lib/iroute.dart | by90/iroute | 707ad7841c460d37c51bf05e62fb7b12219f7730 | [
"BSD-3-Clause"
] | null | null | null | lib/iroute.dart | by90/iroute | 707ad7841c460d37c51bf05e62fb7b12219f7730 | [
"BSD-3-Clause"
] | 41 | 2021-02-25T09:02:05.000Z | 2021-11-01T08:23:50.000Z | lib/iroute.dart | by90/iroute | 707ad7841c460d37c51bf05e62fb7b12219f7730 | [
"BSD-3-Clause"
] | null | null | null | library iroute;
export 'src/iroute.dart';
| 10.75 | 25 | 0.744186 |
caf32d7794ab6178e0b3fcbbf72c57c0c3e9c591 | 2,347 | dart | Dart | lib/src/domain/api/weibo_user_info_resp.jser.dart | talisk/fake_weibo | cb5b5dfc27a505a05009c8179e8dbc31102ff0f9 | [
"Apache-2.0"
] | null | null | null | lib/src/domain/api/weibo_user_info_resp.jser.dart | talisk/fake_weibo | cb5b5dfc27a505a05009c8179e8dbc31102ff0f9 | [
"Apache-2.0"
] | null | null | null | lib/src/domain/api/weibo_user_info_resp.jser.dart | talisk/fake_weibo | cb5b5dfc27a505a05009c8179e8dbc31102ff0f9 | [
"Apache-2.0"
] | null | null | null | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'weibo_user_info_resp.dart';
// **************************************************************************
// JaguarSerializerGenerator
// **************************************************************************
abstract class _$WeiboUserInfoRespSerializer
implements Serializer<WeiboUserInfoResp> {
@override
Map<String, dynamic> toMap(WeiboUserInfoResp model) {
if (model == null) return null;
Map<String, dynamic> ret = <String, dynamic>{};
setMapValue(ret, 'id', model.id);
setMapValue(ret, 'idstr', model.idstr);
setMapValue(ret, 'screen_name', model.screenName);
setMapValue(ret, 'name', model.name);
setMapValue(ret, 'location', model.location);
setMapValue(ret, 'description', model.description);
setMapValue(ret, 'profile_image_url', model.profileImageUrl);
setMapValue(ret, 'gender', model.gender);
setMapValue(ret, 'avatar_large', model.avatarLarge);
setMapValue(ret, 'avatar_hd', model.avatarHd);
setMapValue(ret, 'error_code', model.errorCode);
setMapValue(ret, 'error', model.error);
setMapValue(ret, 'request', model.request);
return ret;
}
@override
WeiboUserInfoResp fromMap(Map map) {
if (map == null) return null;
final obj = new WeiboUserInfoResp(
errorCode: map['error_code'] as int ?? getJserDefault('errorCode'),
error: map['error'] as String ?? getJserDefault('error'),
request: map['request'] as String ?? getJserDefault('request'),
id: map['id'] as int ?? getJserDefault('id'),
idstr: map['idstr'] as String ?? getJserDefault('idstr'),
screenName:
map['screen_name'] as String ?? getJserDefault('screenName'),
name: map['name'] as String ?? getJserDefault('name'),
location: map['location'] as String ?? getJserDefault('location'),
description:
map['description'] as String ?? getJserDefault('description'),
profileImageUrl: map['profile_image_url'] as String ??
getJserDefault('profileImageUrl'),
gender: map['gender'] as String ?? getJserDefault('gender'),
avatarLarge:
map['avatar_large'] as String ?? getJserDefault('avatarLarge'),
avatarHd: map['avatar_hd'] as String ?? getJserDefault('avatarHd'));
return obj;
}
}
| 42.672727 | 77 | 0.619088 |
ae365f7c5d6cd6dfafe148f4fb184364054f9845 | 341 | rs | Rust | examples/list-orders.rs | duncandean/luno-rust | 28498862f8088e68272407d6999558baa43b16fd | [
"MIT"
] | 2 | 2019-12-10T10:47:07.000Z | 2021-04-17T17:35:08.000Z | examples/list-orders.rs | duncandean/luno-rust | 28498862f8088e68272407d6999558baa43b16fd | [
"MIT"
] | 58 | 2019-08-19T08:49:11.000Z | 2021-06-25T15:24:37.000Z | examples/list-orders.rs | dunxen/luno-rust | 28498862f8088e68272407d6999558baa43b16fd | [
"MIT"
] | 4 | 2019-07-09T19:01:29.000Z | 2020-09-10T08:05:03.000Z | use luno::{orders::OrderState, LunoClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = LunoClient::new("LUNO_API_KEY", "LUNO_API_SECRET");
Ok(println!(
"{:?}",
client
.orders()
.filter_state(OrderState::COMPLETE)
.filter_created_before(1390168800000)
.list()
.await?
))
}
| 20.058824 | 65 | 0.648094 |
ddec14737c3f41a22b9fd7f1072e32c3dce7ef19 | 3,670 | h | C | final/Grid.h | jake-billings/edu-csci2312 | 4220a3e2859299b9d2ebfc43f01f69d440198979 | [
"MIT"
] | 1 | 2020-12-02T23:18:13.000Z | 2020-12-02T23:18:13.000Z | final/Grid.h | jake-billings/edu-csci2312 | 4220a3e2859299b9d2ebfc43f01f69d440198979 | [
"MIT"
] | null | null | null | final/Grid.h | jake-billings/edu-csci2312 | 4220a3e2859299b9d2ebfc43f01f69d440198979 | [
"MIT"
] | 1 | 2020-11-15T10:51:27.000Z | 2020-11-15T10:51:27.000Z | /**
* Name: Jake Billings
* Date: 04/09/2018
* Class: CSCI 2312
* Description: declaration file containing the Grid class
*/
#ifndef EDU_CSCI2312_GRID_H
#define EDU_CSCI2312_GRID_H
//Include iostream because we have stream operators to define
#include <iostream>
//Include vector because this data structure is a 2D vector
#include <vector>
//Include stdexcept because we throw errors sometimes
#include <stdexcept>
//Include WaterVehicle since the grid contains ships
#include "WaterVehicle.h"
//Include Shot since the grid contains shots
#include "Shot.h"
/**
* Grid
*
* class
*
* A grid is a sparse-array-like object containing ships (type: WaterVehicle) for a game of battleship
*
* Ship objects are stored in a vector and contain coordinate, type, and length information allowing for
* member functions to recreate what it would look like to store a 2D array full of ship fields.
*/
class Grid {
private:
/**
* ships
*
* WaterVehicle[]
*
* all of the ships that have been placed on the grid
*/
vector<WaterVehicle> ships;
/**
* shots
*
* Shot[]
*
* all of the shots that have been fired into the grid
*/
vector<Shot> shots;
/**
* width
*
* int
*
* the width of the grid
*/
unsigned int width;
/**
* height
*
* int
*
* the height of the grid
*/
unsigned int height;
public:
/**
* create an empty grid with a fixed width and height
*
* @param width
* @param height
*/
Grid(unsigned int width, unsigned int height);
/**
* interativelyReadFrom()
*
* execute an interactive process on the streams in/out to construct a grid from user or e2e testing input
*
* @param in LIKE cin
* @param out LIKE cout
*/
void interativelyReadFrom(istream &in, ostream &out);
/**
* canInsert()
*
* returns true if a ship is within grid bounds and does not overlap with other ships
*
* @param ship
* @return
*/
bool canInsert(WaterVehicle ship);
void insert(WaterVehicle ship);
/**
* fireShot()
*
* appends a Shot object to the shots array
*
* @param s
*/
void fireShot(Shot s);
/**
* fireFifteenRandomShots()
*
* fires fifteen random shots into the grid by appending the objects to a vector
*/
void fireFifteenRandomShots();
/**
* getShips()
*
* returns the ships vector so we can get its size later
*
* @return the ships vector
*/
vector<WaterVehicle> getShips() const;
/**
* getShots()
*
* returns the shots vector so we can get its size later
*
* @return the shots vector
*/
vector<Shot> getShots();
/**
* operator<<
*
* prints the entire grid to an output stream
*
* @param out an output stream like cout
* @param grid a grid to print
* @return out stream
*/
friend ostream &operator<<(ostream &out, Grid grid);
void printForOpponent(ostream &out);
/**
* operator>>
*
* reads the entire grid from an input stream
* that points to a csv file with a format similar to the following:
*
* TypeOfShip,Location,HorizOrVer
* Carrier,A1,H
*
* @param in an input stream
* @param grid a grid to read into
* @return in stream
*/
friend istream &operator>>(istream &in, Grid &grid);
//---Getters and Setters---
unsigned int getWidth() const;
unsigned int getHeight() const;
};
#endif //EDU_CSCI2312_GRID_H
| 21.588235 | 110 | 0.60654 |
2a4435538a2f884375a74772d3c4226b6f70f057 | 4,670 | java | Java | platform-mbean/src/main/java/org/jboss/as/platform/mbean/GarbageCollectorResourceDefinition.java | neha-b2001/wildfly-core | fe2a3c001446885373b35b63ed677ce642bbc2d3 | [
"Apache-2.0"
] | 156 | 2015-01-05T09:12:40.000Z | 2022-03-10T05:38:05.000Z | platform-mbean/src/main/java/org/jboss/as/platform/mbean/GarbageCollectorResourceDefinition.java | neha-b2001/wildfly-core | fe2a3c001446885373b35b63ed677ce642bbc2d3 | [
"Apache-2.0"
] | 3,440 | 2015-01-04T17:16:56.000Z | 2022-03-31T16:47:13.000Z | platform-mbean/src/main/java/org/jboss/as/platform/mbean/GarbageCollectorResourceDefinition.java | neha-b2001/wildfly-core | fe2a3c001446885373b35b63ed677ce642bbc2d3 | [
"Apache-2.0"
] | 448 | 2015-01-08T15:47:49.000Z | 2022-03-17T03:12:10.000Z | /*
*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
* /
*/
package org.jboss.as.platform.mbean;
import static org.jboss.as.controller.registry.AttributeAccess.Flag.COUNTER_METRIC;
import static org.jboss.as.controller.registry.AttributeAccess.Flag.GAUGE_METRIC;
import static org.jboss.as.platform.mbean.PlatformMBeanConstants.NAME;
import java.util.Arrays;
import java.util.List;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.StringListAttributeDefinition;
import org.jboss.as.controller.client.helpers.MeasurementUnit;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.dmr.ModelType;
/**
* @author Tomaz Cerar (c) 2013 Red Hat Inc.
*/
class GarbageCollectorResourceDefinition extends SimpleResourceDefinition {
//metrics
private static SimpleAttributeDefinition COLLECTION_COUNT = SimpleAttributeDefinitionBuilder.create(PlatformMBeanConstants.COLLECTION_COUNT, ModelType.LONG, false)
.setStorageRuntime()
.setRuntimeServiceNotRequired()
.setMeasurementUnit(MeasurementUnit.NONE)
.setFlags(COUNTER_METRIC)
.build();
private static SimpleAttributeDefinition COLLECTION_TIME = SimpleAttributeDefinitionBuilder.create(PlatformMBeanConstants.COLLECTION_TIME, ModelType.LONG, false)
.setStorageRuntime()
.setRuntimeServiceNotRequired()
.setMeasurementUnit(MeasurementUnit.MILLISECONDS)
.setFlags(GAUGE_METRIC)
.build();
private static AttributeDefinition MEMORY_POOL_NAMES = new StringListAttributeDefinition.Builder(PlatformMBeanConstants.MEMORY_POOL_NAMES)
.setStorageRuntime()
.setRuntimeServiceNotRequired()
.build();
private static final List<SimpleAttributeDefinition> METRICS = Arrays.asList(
COLLECTION_COUNT,
COLLECTION_TIME
);
private static final List<AttributeDefinition> READ_ATTRIBUTES = Arrays.asList(
NAME,
PlatformMBeanConstants.VALID,
MEMORY_POOL_NAMES
);
static final List<String> GARBAGE_COLLECTOR_READ_ATTRIBUTES = Arrays.asList(
NAME.getName(),
PlatformMBeanConstants.VALID.getName(),
MEMORY_POOL_NAMES.getName()
);
static final List<String> GARBAGE_COLLECTOR_METRICS = Arrays.asList(
COLLECTION_COUNT.getName(),
COLLECTION_TIME.getName()
);
static final GarbageCollectorResourceDefinition INSTANCE = new GarbageCollectorResourceDefinition();
private GarbageCollectorResourceDefinition() {
super(new Parameters(PathElement.pathElement(NAME.getName()),
PlatformMBeanUtil.getResolver(PlatformMBeanConstants.GARBAGE_COLLECTOR)).setRuntime());
}
@Override
public void registerAttributes(ManagementResourceRegistration registration) {
super.registerAttributes(registration);
registration.registerReadOnlyAttribute(PlatformMBeanConstants.OBJECT_NAME, GarbageCollectorMXBeanAttributeHandler.INSTANCE);
for (AttributeDefinition attribute : READ_ATTRIBUTES) {
registration.registerReadOnlyAttribute(attribute, GarbageCollectorMXBeanAttributeHandler.INSTANCE);
}
for (SimpleAttributeDefinition attribute : METRICS) {
registration.registerMetric(attribute, GarbageCollectorMXBeanAttributeHandler.INSTANCE);
}
}
}
| 42.454545 | 167 | 0.74561 |
874618cd01a226ac02573ac3dfada4ea5a56f3b2 | 7,578 | kt | Kotlin | app/src/main/java/com/example/androiddevchallenge/MainActivity.kt | AnnaMedvedieva/adopt-a-pet | 428af550eeaa58c61413270e1b30cb43938a641f | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/androiddevchallenge/MainActivity.kt | AnnaMedvedieva/adopt-a-pet | 428af550eeaa58c61413270e1b30cb43938a641f | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/androiddevchallenge/MainActivity.kt | AnnaMedvedieva/adopt-a-pet | 428af550eeaa58c61413270e1b30cb43938a641f | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2021 The Android Open Source Project
*
* 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.example.androiddevchallenge
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Card
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.navigate
import androidx.navigation.compose.rememberNavController
import com.example.androiddevchallenge.model.Dog
import com.example.androiddevchallenge.model.dogsList
import com.example.androiddevchallenge.ui.theme.MyTheme
import com.example.androiddevchallenge.ui.theme.purple700
import com.example.androiddevchallenge.ui.theme.typography
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyTheme {
MyApp()
}
}
}
}
@Composable
fun MyApp() {
val navController = rememberNavController()
Scaffold(
topBar = {
TopAppBar(
backgroundColor = Color.White,
elevation = 4.dp,
title = { Text(text = "Puppy Adoption App") },
)
},
content = {
NavHost(navController, startDestination = "dogs") {
composable("dogs") { MainScreen(navController) }
composable("details/{id}") { navBackStackEntry ->
val dog =
dogsList.first { it.id == navBackStackEntry.arguments!!.getString("id")!! }
DetailsScreen(dog)
}
}
}
)
}
@Composable
fun MainScreen(navController: NavController) {
Surface(color = MaterialTheme.colors.background) {
Column(modifier = Modifier.padding(4.dp)) {
LazyColumn(
contentPadding = PaddingValues(horizontal = 8.dp, vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
modifier = Modifier.fillMaxWidth()
) {
items(dogsList) { dog ->
ListItem(dog) {
navController.navigate("details/${dog.id}")
}
}
}
}
}
}
@Composable
fun ListItem(dog: Dog, onItemClick: (Dog) -> Unit) {
Card(
elevation = 4.dp,
shape = RoundedCornerShape(3.dp),
modifier = Modifier
.clickable { onItemClick(dog) }
.height(100.dp)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
) {
Image(
painter = painterResource(id = dog.image),
contentDescription = null,
modifier = Modifier
.padding(8.dp)
.border(1.dp, Color.DarkGray, CircleShape)
.width(86.dp)
.height(86.dp)
.clip(shape = CircleShape),
contentScale = ContentScale.Crop
)
Spacer(Modifier.width(16.dp))
Column {
Text(text = dog.name, style = typography.body1)
Spacer(modifier = Modifier.padding(4.dp))
Text(text = "Breed: ${dog.breed}", style = typography.body2)
Text(text = "Age: ${dog.age}", style = typography.body2)
Text(text = dog.gender, style = typography.body2)
}
}
}
}
@Composable
fun DetailsScreen(dog: Dog) {
Column() {
Image(
painter = painterResource(id = dog.image),
contentDescription = null,
modifier = Modifier
.requiredHeight(320.dp)
.fillMaxWidth(),
contentScale = ContentScale.Crop
)
Column(Modifier.padding(24.dp)) {
Text(text = dog.name, style = typography.body1)
Spacer(modifier = Modifier.padding(4.dp))
Text(text = "Breed: ${dog.breed}", style = typography.body2)
Text(text = "Age: ${dog.age}", style = typography.body2)
Text(text = dog.gender, style = typography.body2)
Spacer(modifier = Modifier.padding(8.dp))
Text(
text = "${dog.name} is a good looking dog who is well behaved. ${dog.name} loves to play ball and is very good at bringing it back and handing it to you. This little dog is good on the lead and travels well in the car. ${dog.name} has a good nature and a good temperament and would be suitable for anyone.",
style = typography.body1
)
Spacer(modifier = Modifier.height(24.dp))
Button(
onClick = { },
colors = ButtonDefaults.buttonColors(backgroundColor = purple700),
shape = RoundedCornerShape(8.dp),
modifier = Modifier
.fillMaxWidth(),
content = {
Text(text = "Adopt Me", color = Color.White)
}
)
}
}
}
@Preview("Light Theme", widthDp = 360, heightDp = 640)
@Composable
fun LightPreview() {
MyTheme {
MyApp()
}
}
@Preview("Dark Theme", widthDp = 360, heightDp = 640)
@Composable
fun DarkPreview() {
MyTheme(darkTheme = true) {
MyApp()
}
}
| 36.258373 | 323 | 0.63658 |
75d7535686b1ffffcc3a13a93a5ddd3e4c5e4412 | 10,001 | cshtml | C# | src/Hatra/Views/SiteSettings/Index.cshtml | Amirarsalan99m/HatraDuplicate | 59a097b006987293be2d0fa47cf05ab3e146c7c1 | [
"Apache-2.0"
] | 1 | 2020-02-23T13:46:51.000Z | 2020-02-23T13:46:51.000Z | src/Hatra/Views/SiteSettings/Index.cshtml | Amirarsalan99m/HatraDuplicate | 59a097b006987293be2d0fa47cf05ab3e146c7c1 | [
"Apache-2.0"
] | 2 | 2022-01-26T09:08:35.000Z | 2022-01-26T09:08:52.000Z | src/Hatra/Views/SiteSettings/Index.cshtml | Amirarsalan99m/HatraDuplicate | 59a097b006987293be2d0fa47cf05ab3e146c7c1 | [
"Apache-2.0"
] | 4 | 2020-02-23T13:46:55.000Z | 2020-05-23T10:11:32.000Z | @model ShowingSettingSite
@{
ViewData["Title"] = "تنظیمات نمایشی سایت";
}
<div class="card mt-5">
<div class="card-header">
<h5 class="card-title">@ViewData["Title"]</h5>
</div>
<div class="card-body">
<form asp-controller="SiteSettings"
asp-action="Save"
method="post"
enctype="multipart/form-data">
<partial name="_CustomValidationSummary" />
<div class="form-group row">
<label asp-for="EnglishSiteName" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="EnglishSiteName" class="form-control" />
<span asp-validation-for="EnglishSiteName" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="PersianSiteName" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="PersianSiteName" class="form-control" />
<span asp-validation-for="PersianSiteName" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Description" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="FooterDescription" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="FooterDescription" class="form-control" />
<span asp-validation-for="FooterDescription" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="SiteKeywords" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="SiteKeywords" class="form-control" />
<span asp-validation-for="SiteKeywords" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Owner" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="Owner" class="form-control" />
<span asp-validation-for="Owner" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Email" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="SiteUrl" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="SiteUrl" class="form-control" />
<span asp-validation-for="SiteUrl" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="WorkTime" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="WorkTime" class="form-control" />
<span asp-validation-for="WorkTime" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Tell1" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Tell1" class="form-control" />
<span asp-validation-for="Tell1" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Tell2" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Tell2" class="form-control" />
<span asp-validation-for="Tell2" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Address" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="rtl" asp-for="Address" class="form-control" />
<span asp-validation-for="Address" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Twitter" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Twitter" class="form-control" />
<span asp-validation-for="Twitter" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Facebook" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Facebook" class="form-control" />
<span asp-validation-for="Facebook" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Skype" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Skype" class="form-control" />
<span asp-validation-for="Skype" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Pinterest" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Pinterest" class="form-control" />
<span asp-validation-for="Pinterest" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Telegram" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Telegram" class="form-control" />
<span asp-validation-for="Telegram" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Instagram" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Instagram" class="form-control" />
<span asp-validation-for="Instagram" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="LinkedIn" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="LinkedIn" class="form-control" />
<span asp-validation-for="LinkedIn" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="WhatsApp" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="WhatsApp" class="form-control" />
<span asp-validation-for="WhatsApp" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Latitude" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Latitude" class="form-control" />
<span asp-validation-for="Latitude" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Longitude" class="col-md-2 col-form-label text-md-left"></label>
<div class="col-md-10">
<input dir="ltr" asp-for="Longitude" class="form-control" />
<span asp-validation-for="Longitude" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<div class="offset-md-2 col-md-10">
<security-trimming asp-area="" asp-controller="SiteSettings" asp-action="Save">
<button type="submit" class="btn btn-info col-md-2">ارسال</button>
</security-trimming>
</div>
</div>
</form>
</div>
</div> | 55.561111 | 108 | 0.456854 |
b43fc1751d69d4f1cdb956d05f544fc260d0e410 | 123 | sql | SQL | jpa2ddl-core/src/test/resources/sample_migration/v1__jpa2ddl_init.sql | hinrik/jpa2ddl | 8cfb85ce4b437d4020e490001056203172d8780f | [
"Apache-2.0"
] | 103 | 2017-11-02T16:46:09.000Z | 2022-02-28T05:24:39.000Z | jpa2ddl-core/src/test/resources/sample_migration/v1__jpa2ddl_init.sql | hinrik/jpa2ddl | 8cfb85ce4b437d4020e490001056203172d8780f | [
"Apache-2.0"
] | 36 | 2017-10-23T11:26:31.000Z | 2022-03-25T02:02:12.000Z | jpa2ddl-core/src/test/resources/sample_migration/v1__jpa2ddl_init.sql | hinrik/jpa2ddl | 8cfb85ce4b437d4020e490001056203172d8780f | [
"Apache-2.0"
] | 36 | 2017-10-27T11:23:44.000Z | 2022-03-24T04:31:05.000Z | CREATE SCHEMA prod;
create table prod.User (
id bigint not null,
date datetime(6),
primary key (id)
) engine=InnoDB; | 17.571429 | 24 | 0.707317 |
4497bec5b979cc7adc19a14c1776a70942e78a8c | 3,010 | kt | Kotlin | kotlinx-coroutines-core/jvm/test/selects/SelectDeadlockLFStressTest.kt | iurgnid/kotlinx.coroutines | f49fbf61ec2c83f43d9a09fcee078251a086b157 | [
"Apache-2.0"
] | 3 | 2021-07-07T12:21:42.000Z | 2021-08-20T09:35:18.000Z | kotlinx-coroutines-core/jvm/test/selects/SelectDeadlockLFStressTest.kt | iurgnid/kotlinx.coroutines | f49fbf61ec2c83f43d9a09fcee078251a086b157 | [
"Apache-2.0"
] | 1 | 2022-02-11T21:33:21.000Z | 2022-02-11T21:33:21.000Z | kotlinx-coroutines-core/jvm/test/selects/SelectDeadlockLFStressTest.kt | iurgnid/kotlinx.coroutines | f49fbf61ec2c83f43d9a09fcee078251a086b157 | [
"Apache-2.0"
] | 1 | 2020-05-18T13:59:30.000Z | 2020-05-18T13:59:30.000Z | /*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines.selects
import kotlinx.atomicfu.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.junit.*
import org.junit.Ignore
import org.junit.Test
import kotlin.math.*
import kotlin.test.*
/**
* A stress-test on lock-freedom of select sending/receiving into opposite channels.
*/
class SelectDeadlockLFStressTest : TestBase() {
private val env = LockFreedomTestEnvironment("SelectDeadlockLFStressTest", allowSuspendedThreads = 1)
private val nSeconds = 5 * stressTestMultiplier
private val c1 = Channel<Long>()
private val c2 = Channel<Long>()
@Test
fun testLockFreedom() = testScenarios(
"s1r2",
"s2r1",
"r1s2",
"r2s1"
)
private fun testScenarios(vararg scenarios: String) {
env.onCompletion {
c1.cancel(TestCompleted())
c2.cancel(TestCompleted())
}
val t = scenarios.mapIndexed { i, scenario ->
val idx = i + 1L
TestDef(idx, "$idx [$scenario]", scenario)
}
t.forEach { it.test() }
env.performTest(nSeconds) {
t.forEach { println(it) }
}
}
private inner class TestDef(
var sendIndex: Long = 0L,
val name: String,
scenario: String
) {
var receiveIndex = 0L
val clauses: List<SelectBuilder<Unit>.() -> Unit> = ArrayList<SelectBuilder<Unit>.() -> Unit>().apply {
require(scenario.length % 2 == 0)
for (i in scenario.indices step 2) {
val ch = when (val c = scenario[i + 1]) {
'1' -> c1
'2' -> c2
else -> error("Channel '$c'")
}
val clause = when (val op = scenario[i]) {
's' -> fun SelectBuilder<Unit>.() { sendClause(ch) }
'r' -> fun SelectBuilder<Unit>.() { receiveClause(ch) }
else -> error("Operation '$op'")
}
add(clause)
}
}
fun test() = env.testThread(name) {
doSendReceive()
}
private suspend fun doSendReceive() {
try {
select<Unit> {
for (clause in clauses) clause()
}
} catch (e: TestCompleted) {
assertTrue(env.isCompleted)
}
}
private fun SelectBuilder<Unit>.sendClause(c: Channel<Long>) =
c.onSend(sendIndex) {
sendIndex += 4L
}
private fun SelectBuilder<Unit>.receiveClause(c: Channel<Long>) =
c.onReceive { i ->
receiveIndex = max(i, receiveIndex)
}
override fun toString(): String = "$name: send=$sendIndex, received=$receiveIndex"
}
private class TestCompleted : CancellationException()
} | 29.80198 | 111 | 0.538206 |
6842c81d6fbe5bebae4af3920f52ecf249f00019 | 2,140 | dart | Dart | lib/constant/constant.dart | chillley/saga | 08f1d1bf30852d197ad2b91223de03e2fd2f5bf1 | [
"MIT"
] | null | null | null | lib/constant/constant.dart | chillley/saga | 08f1d1bf30852d197ad2b91223de03e2fd2f5bf1 | [
"MIT"
] | null | null | null | lib/constant/constant.dart | chillley/saga | 08f1d1bf30852d197ad2b91223de03e2fd2f5bf1 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'dart:ui';
/// @description 常量类
/// @date 2022/2/18 14:43
/// @author xialei
export 'extension.dart';
export 'top_const.dart';
class Constant {
static bool get isMobile => isAndroid || isIOS;
static bool get isWeb => kIsWeb;
static bool get isWindows => !isWeb && Platform.isWindows;
static bool get isLinux => !isWeb && Platform.isLinux;
static bool get isMacOS => !isWeb && Platform.isMacOS;
static bool get isAndroid => !isWeb && Platform.isAndroid;
static bool get isFuchsia => !isWeb && Platform.isFuchsia;
static bool get isIOS => !isWeb && Platform.isIOS;
static final MediaQueryData mediaQueryData =
MediaQueryData.fromWindow(window);
static final Size screenSize = mediaQueryData.size;
static final double screenWidth = screenSize.width;
static final double screenHeight = screenSize.height;
static late AndroidDeviceInfo _androidInfo;
static Future<void> initDeviceInfo() async {
if (isAndroid) {
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
_androidInfo = await deviceInfo.androidInfo;
}
}
static const String requestSuccess = 'SUCCESS';
/// 主题色
static const Color themeColor = Color(0xFF3371FF);
///辅助色
static const Color assistColor = Color(0xFFCBDBFF);
/// 辅助色2
static const Color assist2Color = Color(0xFF00D184);
/// 辅助色3
static const Color assist3Color = Color(0xFFFFA021);
/// 点缀色
static const Color intersperseColor = Color(0xFFFF5C5C);
/// 一级标题
static const Color primaryTitleColor = Color(0xFF333333);
/// 正文 内容
static const Color textColor = Color(0xFF666666);
/// 辅助文字颜色
static const Color assistTextColor = Color(0xFFBFBEBE);
/// 书架 icon
static const Icon bookRackIcon = Icon(Icons.menu_book);
/// 分类 icon
static const Icon classifyIcon = Icon(Icons.menu);
/// 书城 icon
static const Icon bookMallIcon = Icon(Icons.home);
/// 我的 icon
static const Icon userIcon = Icon(Icons.person);
const Constant._();
}
| 24.044944 | 61 | 0.714019 |
c555b67e1253fa6193e6baa9297654c8c69ea8c1 | 1,653 | dart | Dart | lib/screens/home.dart | theindianappguy/rest_app | 8a9694cb4893579bf7031fae15da61b610789408 | [
"Apache-2.0"
] | 198 | 2020-01-30T11:32:04.000Z | 2022-03-24T05:50:33.000Z | lib/screens/home.dart | theindianappguy/rest_app | 8a9694cb4893579bf7031fae15da61b610789408 | [
"Apache-2.0"
] | 1 | 2020-02-10T19:25:11.000Z | 2020-08-15T13:38:00.000Z | lib/screens/home.dart | theindianappguy/rest_app | 8a9694cb4893579bf7031fae15da61b610789408 | [
"Apache-2.0"
] | 65 | 2020-01-30T11:56:49.000Z | 2022-03-14T12:28:15.000Z | import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:rest_app/services/auth_services.dart';
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
AuthService _authService = AuthService();
bool _loading = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black54,
appBar: AppBar(
title: Text(
"RESTAPP",
style: GoogleFonts.roboto(
textStyle: TextStyle(fontSize: 18, letterSpacing: 1)),
),
backgroundColor: Colors.black87,
centerTitle: true,
actions: <Widget>[
],
),
body: _loading ? Container(
alignment: Alignment.center,
child: CircularProgressIndicator(),
) : Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Hello World"),
SizedBox(height: 30,),
FlatButton(
color: Color(0xff465EFB),
onPressed: () async {
setState(() {
_loading = true;
});
dynamic result = await _authService.signOut();
if(result == null){
print("error");
}else{
print("success");
}
setState(() {
_loading = false;
});
},
child: Text("Log Out"),
)
],
)
),
);
}
}
| 25.828125 | 68 | 0.513612 |
fbaa7cf3dbfb8bada011cfab89a1963abbb80184 | 13,992 | h | C | System/Library/Frameworks/Photos.framework/PHAssetCreationRequest.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | System/Library/Frameworks/Photos.framework/PHAssetCreationRequest.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | System/Library/Frameworks/Photos.framework/PHAssetCreationRequest.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | /*
* This header is generated by classdump-dyld 1.5
* on Friday, April 30, 2021 at 11:36:04 AM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/Frameworks/Photos.framework/Photos
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <Photos/Photos-Structs.h>
#import <Photos/PHAssetChangeRequest.h>
#import <libobjc.A.dylib/PHInsertChangeRequest.h>
#import <libobjc.A.dylib/PHMomentSharePropertySet.h>
@class NSMutableArray, PHAssetResourceBag, NSMutableDictionary, PLManagedAsset, NSObject, NSData, NSString, PHAssetCreationPhotoStreamPublishingRequest, PHMomentShare, PHRelationshipChangeRequestHelper, PHAssetCreationAdjustmentBakeInOptions, PHAssetCreationMetadataCopyOptions, NSDictionary, NSManagedObjectID;
@interface PHAssetCreationRequest : PHAssetChangeRequest <PHInsertChangeRequest, PHMomentSharePropertySet> {
NSMutableArray* _assetResources;
PHAssetResourceBag* _assetResourceBag;
NSMutableDictionary* _movedFiles;
BOOL _duplicateAllowsPrivateMetadata;
BOOL _shouldCreateScreenshot;
/*^block*/id _concurrentWorkBlock;
PLManagedAsset* _asset;
NSObject* _previewImage;
NSObject* _thumbnailImage;
NSData* _originalHash;
BOOL _shouldPerformConcurrentWork;
BOOL _duplicateLivePhotoAsStill;
BOOL _duplicateAsOriginal;
BOOL _duplicateSinglePhotoFromBurst;
BOOL _duplicateSpatialOverCaptureResources;
short _importedBy;
unsigned short _duplicateAssetPhotoLibraryType;
NSString* _importSessionID;
PHAssetCreationPhotoStreamPublishingRequest* __photoStreamPublishingRequest;
PHMomentShare* _momentShare;
NSString* _momentShareUUID;
PHRelationshipChangeRequestHelper* _momentShareHelper;
NSString* _duplicateAssetIdentifier;
PHAssetCreationAdjustmentBakeInOptions* _adjustmentBakeInOptions;
PHAssetCreationMetadataCopyOptions* _metadataCopyOptions;
/*^block*/id _destinationAssetAvailabilityHandler;
SCD_Struct_PH9 _duplicateStillSourceTime;
}
@property (setter=_setPhotoStreamPublishingRequest:,nonatomic,retain) PHAssetCreationPhotoStreamPublishingRequest * _photoStreamPublishingRequest; //@synthesize _photoStreamPublishingRequest=__photoStreamPublishingRequest - In the implementation block
@property (nonatomic,readonly) NSDictionary * _movedFiles;
@property (assign,setter=_setDuplicateAllowsPrivateMetadata:,nonatomic) BOOL duplicateAllowsPrivateMetadata;
@property (assign,setter=_setShouldCreateScreenshot:,getter=_shouldCreateScreenshot,nonatomic) BOOL shouldCreateScreenshot;
@property (nonatomic,retain) PHMomentShare * momentShare; //@synthesize momentShare=_momentShare - In the implementation block
@property (nonatomic,retain) NSString * momentShareUUID; //@synthesize momentShareUUID=_momentShareUUID - In the implementation block
@property (assign,nonatomic) BOOL shouldPerformConcurrentWork; //@synthesize shouldPerformConcurrentWork=_shouldPerformConcurrentWork - In the implementation block
@property (nonatomic,readonly) PHRelationshipChangeRequestHelper * momentShareHelper; //@synthesize momentShareHelper=_momentShareHelper - In the implementation block
@property (setter=_setDuplicateAssetIdentifier:,nonatomic,retain) NSString * duplicateAssetIdentifier; //@synthesize duplicateAssetIdentifier=_duplicateAssetIdentifier - In the implementation block
@property (assign,setter=_setDuplicateAssetPhotoLibraryType:,nonatomic) unsigned short duplicateAssetPhotoLibraryType; //@synthesize duplicateAssetPhotoLibraryType=_duplicateAssetPhotoLibraryType - In the implementation block
@property (assign,setter=_setDuplicateStillSourceTime:,nonatomic) SCD_Struct_PH9 duplicateStillSourceTime; //@synthesize duplicateStillSourceTime=_duplicateStillSourceTime - In the implementation block
@property (assign,setter=_setDuplicateLivePhotoAsStill:,nonatomic) BOOL duplicateLivePhotoAsStill; //@synthesize duplicateLivePhotoAsStill=_duplicateLivePhotoAsStill - In the implementation block
@property (assign,setter=_setDuplicateAsOriginal:,nonatomic) BOOL duplicateAsOriginal; //@synthesize duplicateAsOriginal=_duplicateAsOriginal - In the implementation block
@property (assign,setter=_setDuplicateSinglePhotoFromBurst:,nonatomic) BOOL duplicateSinglePhotoFromBurst; //@synthesize duplicateSinglePhotoFromBurst=_duplicateSinglePhotoFromBurst - In the implementation block
@property (assign,setter=_setDuplicateSpatialOverCaptureResources:,nonatomic) BOOL duplicateSpatialOverCaptureResources; //@synthesize duplicateSpatialOverCaptureResources=_duplicateSpatialOverCaptureResources - In the implementation block
@property (setter=_setAdjustmentBakeInOptions:,nonatomic,copy) PHAssetCreationAdjustmentBakeInOptions * adjustmentBakeInOptions; //@synthesize adjustmentBakeInOptions=_adjustmentBakeInOptions - In the implementation block
@property (setter=_setMetadataCopyOptions:,nonatomic,copy) PHAssetCreationMetadataCopyOptions * metadataCopyOptions; //@synthesize metadataCopyOptions=_metadataCopyOptions - In the implementation block
@property (setter=_setDestinationAssetAvailabilityHandler:,nonatomic,copy) id destinationAssetAvailabilityHandler; //@synthesize destinationAssetAvailabilityHandler=_destinationAssetAvailabilityHandler - In the implementation block
@property (nonatomic,retain) NSString * importSessionID; //@synthesize importSessionID=_importSessionID - In the implementation block
@property (assign,nonatomic) short importedBy; //@synthesize importedBy=_importedBy - In the implementation block
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
@property (nonatomic,readonly) NSString * managedEntityName;
@property (nonatomic,readonly) NSManagedObjectID * objectID;
@property (getter=isClientEntitled,nonatomic,readonly) BOOL clientEntitled;
@property (nonatomic,readonly) NSString * clientName;
@property (readonly) BOOL isNewRequest;
@property (nonatomic,readonly) id concurrentWorkBlock;
+(id)_creationRequestForAssetUsingUUID:(id)arg1 ;
+(id)creationRequestForAsset;
+(id)creationRequestForAssetFromImageData:(id)arg1 ;
+(id)creationRequestForAssetFromImageData:(id)arg1 usingUUID:(id)arg2 ;
+(id)creationRequestForAssetFromScreenshotImage:(id)arg1 ;
+(id)creationRequestForAssetFromImage:(id)arg1 ;
+(id)creationRequestForAssetFromImageAtFileURL:(id)arg1 ;
+(id)creationRequestForAssetFromVideoAtFileURL:(id)arg1 ;
+(id)creationRequestForAssetFromVideoComplementBundle:(id)arg1 ;
+(id)creationRequestForAssetFromAssetBundle:(id)arg1 ;
+(id)creationRequestForAssetCopyFromAsset:(id)arg1 options:(id)arg2 ;
+(id)creationRequestForAssetCopyFromAsset:(id)arg1 ;
+(BOOL)supportsAssetResourceTypes:(id)arg1 ;
+(BOOL)supportsImportAssetResourceTypes:(id)arg1 ;
-(id)initWithHelper:(id)arg1 ;
-(void)setMomentShare:(PHMomentShare *)arg1 ;
-(PHMomentShare *)momentShare;
-(void)setImportedBy:(short)arg1 ;
-(NSString *)importSessionID;
-(void)setImportSessionID:(NSString *)arg1 ;
-(short)importedBy;
-(NSString *)momentShareUUID;
-(void)setMomentShareUUID:(NSString *)arg1 ;
-(BOOL)applyMutationsToManagedObject:(id)arg1 photoLibrary:(id)arg2 error:(id*)arg3 ;
-(void)encodeToXPCDict:(id)arg1 ;
-(id)initWithXPCDict:(id)arg1 request:(id)arg2 clientAuthorization:(id)arg3 ;
-(id)initForNewObject;
-(BOOL)validateInsertIntoPhotoLibrary:(id)arg1 error:(id*)arg2 ;
-(id)createManagedObjectForInsertIntoPhotoLibrary:(id)arg1 error:(id*)arg2 ;
-(void)performTransactionCompletionHandlingInPhotoLibrary:(id)arg1 ;
-(void)finalizeRequestWithBatchSuccess:(BOOL)arg1 ;
-(id)concurrentWorkBlock;
-(id)initForNewObjectWithUUID:(id)arg1 ;
-(void)_setDestinationAssetAvailabilityHandler:(/*^block*/id)arg1 ;
-(id)destinationAssetAvailabilityHandler;
-(PHAssetCreationAdjustmentBakeInOptions *)adjustmentBakeInOptions;
-(PHAssetCreationMetadataCopyOptions *)metadataCopyOptions;
-(NSDictionary *)_movedFiles;
-(BOOL)_shouldCreateScreenshot;
-(void)_copyMetadataFromAsset:(id)arg1 ;
-(void)_copyUserSpecificMetadataFromAsset:(id)arg1 ;
-(void)_copyMediaAnalysisProperties:(id)arg1 ;
-(void)_didMoveFileFromURL:(id)arg1 toURL:(id)arg2 ;
-(BOOL)_restoreMovedFilesOnFailure;
-(void)_resetMovedFiles;
-(id)_secureMove:(BOOL)arg1 fileAtURL:(id)arg2 toURL:(id)arg3 capabilities:(id)arg4 error:(id*)arg5 ;
-(id)_secureMove:(BOOL)arg1 assetResource:(id)arg2 photoLibrary:(id)arg3 error:(id*)arg4 ;
-(void)updateOriginalResourceOptionsWithResource:(id)arg1 sourceUrl:(id)arg2 ;
-(id)makeSubstitueRenderImageFileFromPath:(id)arg1 primaryResource:(id)arg2 fileSuffix:(id)arg3 error:(id*)arg4 ;
-(id)makeSubstitueRenderVideoFileFromPath:(id)arg1 primaryResource:(id)arg2 fileSuffix:(id)arg3 error:(id*)arg4 ;
-(BOOL)_createAssetAsAdjusted:(id)arg1 fromValidatedResources:(id)arg2 error:(id*)arg3 ;
-(BOOL)_ingestOriginalInPlaceSrcURL:(id)arg1 dstURL:(id)arg2 asset:(id)arg3 error:(id*)arg4 ;
-(id)_ingestOriginalFromSrcURL:(id)arg1 toDstURL:(id)arg2 useSecureMove:(BOOL)arg3 resource:(id)arg4 resourceType:(unsigned)arg5 asset:(id)arg6 error:(id*)arg7 ;
-(BOOL)_createAssetAsPhotoIris:(id)arg1 fromValidatedResources:(id)arg2 error:(id*)arg3 ;
-(BOOL)_createRAWSidecarForAsset:(id)arg1 fromValidatedResources:(id)arg2 photoLibrary:(id)arg3 error:(id*)arg4 ;
-(BOOL)_createSocResourceForAsset:(id)arg1 fromValidatedResources:(id)arg2 photoLibrary:(id)arg3 error:(id*)arg4 ;
-(BOOL)_createXmpResourceForAsset:(id)arg1 fromValidatedResources:(id)arg2 photoLibrary:(id)arg3 error:(id*)arg4 ;
-(BOOL)_createAudioResourceForAsset:(id)arg1 fromValidatedResources:(id)arg2 photoLibrary:(id)arg3 error:(id*)arg4 ;
-(BOOL)_createOriginalResourceForAsset:(id)arg1 fromValidatedResource:(id)arg2 resourceType:(unsigned)arg3 photoLibrary:(id)arg4 destinationURL:(id)arg5 error:(id*)arg6 ;
-(id)_exifPropertiesFromSourceImageDataExifProperties:(id)arg1 ;
-(short)_savedAssetTypeForAsset;
-(id)_managedAssetFromPrimaryResourceData:(id)arg1 withUUID:(id)arg2 photoLibrary:(id)arg3 getImageSource:(CGImageSource*)arg4 imageData:(id*)arg5 ;
-(BOOL)_accessWritableURLForUUID:(id)arg1 imageUTI:(id)arg2 originalFilename:(id)arg3 photoLibrary:(id)arg4 withHandler:(/*^block*/id)arg5 ;
-(BOOL)_writeDataToDisk:(id)arg1 imageUTIType:(id)arg2 exifProperties:(id)arg3 mainFileURL:(id)arg4 thumbnailData:(id)arg5 ;
-(id)_externalLivePhotoResourceForAsset:(id)arg1 ;
-(void)_pairLivePhotoResource:(id)arg1 withAssetInLibrary:(id)arg2 metadata:(id)arg3 completion:(/*^block*/id)arg4 ;
-(void)_setupConcurrentWorkIfNecessaryWithImageSource:(CGImageSourceRef)arg1 originalImageData:(id)arg2 ;
-(id)_sourceOptionsForCreateThumbnailWithAsset:(id)arg1 hasAdjustments:(BOOL)arg2 ;
-(id)createAssetFromValidatedResources:(id)arg1 withUUID:(id)arg2 inPhotoLibrary:(id)arg3 error:(id*)arg4 ;
-(BOOL)needsConcurrentWork;
-(void)addResourceWithType:(long long)arg1 fileURL:(id)arg2 options:(id)arg3 ;
-(void)addResourceWithType:(long long)arg1 data:(id)arg2 options:(id)arg3 ;
-(void)_addResourceWithType:(long long)arg1 data:(id)arg2 orFileURL:(id)arg3 options:(id)arg4 ;
-(id)placeholderForCreatedAsset;
-(long long)_mediaTypeForCreatedAsset;
-(id)_duplicatedAssetResourcesFromAsset:(id)arg1 stillSourceTime:(SCD_Struct_PH9)arg2 flattenLivePhotoIntoStillPhoto:(BOOL)arg3 original:(BOOL)arg4 removeBurstIdentifier:(BOOL)arg5 error:(id*)arg6 ;
-(void)_updateMutationsForDuplicatingPrivateMetadataFromAsset:(id)arg1 ;
-(BOOL)_populateDuplicatingAssetCreationRequest:(id)arg1 photoLibrary:(id)arg2 error:(id*)arg3 ;
-(void)_prepareMomentShareHelperIfNeeded;
-(id)_mutableMomentShareObjectIDsAndUUIDs;
-(BOOL)isNew;
-(void)_setDuplicateAllowsPrivateMetadata:(BOOL)arg1 ;
-(BOOL)duplicateAllowsPrivateMetadata;
-(void)_setShouldCreateScreenshot:(BOOL)arg1 ;
-(PHAssetCreationPhotoStreamPublishingRequest *)_photoStreamPublishingRequest;
-(void)_setPhotoStreamPublishingRequest:(id)arg1 ;
-(BOOL)shouldPerformConcurrentWork;
-(void)setShouldPerformConcurrentWork:(BOOL)arg1 ;
-(PHRelationshipChangeRequestHelper *)momentShareHelper;
-(NSString *)duplicateAssetIdentifier;
-(void)_setDuplicateAssetIdentifier:(id)arg1 ;
-(unsigned short)duplicateAssetPhotoLibraryType;
-(void)_setDuplicateAssetPhotoLibraryType:(unsigned short)arg1 ;
-(SCD_Struct_PH9)duplicateStillSourceTime;
-(void)_setDuplicateStillSourceTime:(SCD_Struct_PH9)arg1 ;
-(BOOL)duplicateLivePhotoAsStill;
-(void)_setDuplicateLivePhotoAsStill:(BOOL)arg1 ;
-(BOOL)duplicateAsOriginal;
-(void)_setDuplicateAsOriginal:(BOOL)arg1 ;
-(BOOL)duplicateSinglePhotoFromBurst;
-(void)_setDuplicateSinglePhotoFromBurst:(BOOL)arg1 ;
-(BOOL)duplicateSpatialOverCaptureResources;
-(void)_setDuplicateSpatialOverCaptureResources:(BOOL)arg1 ;
-(void)_setAdjustmentBakeInOptions:(id)arg1 ;
-(void)_setMetadataCopyOptions:(id)arg1 ;
@end
| 75.632432 | 311 | 0.761935 |
7516597278f3ad75f3f33a12ff4da9ad2a46b352 | 195 | cs | C# | BookShelf/Silverlight/BookShelf/Messages/FrameMessage.cs | ehsangfl/Samples | 8a8cc2432ebe367f3b2bbf04e33f95672935db9e | [
"MIT"
] | null | null | null | BookShelf/Silverlight/BookShelf/Messages/FrameMessage.cs | ehsangfl/Samples | 8a8cc2432ebe367f3b2bbf04e33f95672935db9e | [
"MIT"
] | 4 | 2020-08-24T16:52:05.000Z | 2021-06-30T21:01:50.000Z | BookShelf/Silverlight/BookShelf/Messages/FrameMessage.cs | ehsangfl/Samples | 8a8cc2432ebe367f3b2bbf04e33f95672935db9e | [
"MIT"
] | 5 | 2019-08-14T13:11:58.000Z | 2021-09-11T14:40:30.000Z | using System.Windows.Controls;
using GalaSoft.MvvmLight.Messaging;
namespace BookShelf
{
internal class FrameMessage : MessageBase
{
public Frame RootFrame { get; set; }
}
} | 19.5 | 45 | 0.702564 |
7478bdec5bc384f73c910c596251fabe487f4854 | 6,032 | html | HTML | layouts/partials/client-and-work.html | equiden-therapie/raditian-hugo | 4e8516484e9a0df9c0a218f70d0780fea36036fc | [
"MIT"
] | null | null | null | layouts/partials/client-and-work.html | equiden-therapie/raditian-hugo | 4e8516484e9a0df9c0a218f70d0780fea36036fc | [
"MIT"
] | 17 | 2020-06-12T17:44:21.000Z | 2021-01-27T16:00:09.000Z | layouts/partials/client-and-work.html | equiden-therapie/raditian-hugo | 4e8516484e9a0df9c0a218f70d0780fea36036fc | [
"MIT"
] | null | null | null | {{ if .Site.Data.homepage.client_and_work.enable }}
<section id="{{ .Site.Data.homepage.client_and_work.id }}" class="section section--border-bottom">
<div class="container">
{{ if .Site.Data.homepage.client_and_work.title }}
<h2 class=" rad-animation-group rad-fade-down">
{{ .Site.Data.homepage.client_and_work.title }}
</h2>
{{ end }}
{{ if .Site.Data.homepage.client_and_work.clients }}
<div class="row row--padded rad-animation-group rad-fade-down">
<div class="col-12">
<div class="clients">
{{ range .Site.Data.homepage.client_and_work.clients }}
<div class="clients__item">
<a href="https://radity.com">
<img
class="lozad img-responsive"
src="data:image/gif;base64,R0lGODlhBwACAIAAAP///wAAACH5BAEAAAEALAAAAAAHAAIAAAIDjI9YADs="
data-src="{{ .logo.x | absURL }}"
data-srcset="{{ .logo.x | absURL }} 1x, {{ .logo._2x | absURL }} 2x"
alt="{{ .alt }}"
/>
</a>
</div>
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ range $index, $element := .Site.Data.homepage.client_and_work.works }}
<div
class="row row--padded rad-animation-group rad-fade-down {{ if .is_even }}flex-column-reverse flex-md-row{{ end }}"
>
{{ if .is_even }}
<div class="col-12 col-md-5 mt-4 mt-md-0 my-md-auto">
<h3>{{ .title }}</h3>
<p class="lead">
{{ .description | safeHTML }}
</p>
{{ if .button }}
<a href="{{ .button.URL }}" class="btn btn-primary"
>{{ .button.btnText }}<i class="{{ .button.icon }}"></i
></a>
{{ end }}
</div>
<div class="col-12 col-md-7 pl-md-0 text-right">
{{ if .image }}
<img
class='lozad img-responsive {{ cond (eq ( mod $index 4) 0) "img-clip-left-backward" "img-clip-left-forward" }}'
src="data:image/gif;base64,R0lGODlhBwACAIAAAP///wAAACH5BAEAAAEALAAAAAAHAAIAAAIDjI9YADs="
data-src="{{ .image.x | absURL }}"
data-srcset="{{ .image.x | absURL }} 1x, {{ .image._2x | absURL }} 2x"
alt="{{ .title }}"
/>
{{ end }}
{{ if .images }}
<div id="carousel-{{ $index }}" data-ride="carousel" class='carousel slide {{ cond (eq ( mod $index 4) 0) "img-clip-left-backward" "img-clip-left-forward" }}'
>
<div class="carousel-inner">
{{ range $imageIndex, $slide := .images }}
<div class='carousel-item {{ cond (eq ( mod $imageIndex 4) 0) "active" "" }}'>
<img
class="lozad img-responsive d-block w-100"
src="data:image/gif;base64,R0lGODlhBwACAIAAAP///wAAACH5BAEAAAEALAAAAAAHAAIAAAIDjI9YADs="
data-src="{{ $slide.x | absURL }}"
data-srcset="{{ $slide.x | absURL }} 1x, {{ $slide._2x | absURL }} 2x"
alt="{{ .title }}"
/>
</div>
{{ end }}
</div>
<a class="carousel-control-prev" href="#carousel-{{ $index }}" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel-{{ $index }}" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
{{ end }}
</div>
{{ else }}
<div class="col-12 col-md-7 pl-md-0 text-right">
{{ if .image }}
<img
class='lozad img-responsive {{ cond (eq ( mod $index 4) 1) "img-clip-right-backward" "img-clip-right-forward" }}'
src="data:image/gif;base64,R0lGODlhBwACAIAAAP///wAAACH5BAEAAAEALAAAAAAHAAIAAAIDjI9YADs="
data-src="{{ .image.x | absURL }}"
data-srcset="{{ .image.x | absURL }} 1x, {{ .image._2x | absURL }} 2x"
alt="{{ .title }}"
/>
{{ end }}
{{ if .images }}
<div id="carousel-{{ $index }}" data-ride="carousel" class='carousel slide {{ cond (eq ( mod $index 4) 1) "img-clip-right-backward" "img-clip-right-forward" }}'
>
<div class="carousel-inner">
{{ range $imageIndex, $slide := .images }}
<div class='carousel-item {{ cond (eq ( mod $imageIndex 4) 0) "active" "" }}'>
<img
class="lozad img-responsive d-block w-100"
src="data:image/gif;base64,R0lGODlhBwACAIAAAP///wAAACH5BAEAAAEALAAAAAAHAAIAAAIDjI9YADs="
data-src="{{ $slide.x | absURL }}"
data-srcset="{{ $slide.x | absURL }} 1x, {{ $slide._2x | absURL }} 2x"
alt="{{ .title }}"
/>
</div>
{{ end }}
</div>
<a class="carousel-control-prev" href="#carousel-{{ $index }}" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel-{{ $index }}" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
{{ end }}
</div>
<div class="col-12 col-md-5 mt-4 mt-md-0 my-md-auto">
<h3>{{ .title }}</h3>
<p class="lead">
{{ .description | safeHTML }}
</p>
{{ if .button }}
<a href="{{ .button.URL }}" class="btn btn-primary"
>{{ .button.btnText }}<i class="{{ .button.icon }}"></i
></a>
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
</div>
</section>
{{ end }}
| 43.395683 | 168 | 0.499337 |
8c12c3b0a6ae85e7cf41d82f4db1842bf58ccdb2 | 325 | hpp | C++ | Include/Injector/Graphics/GuiEcsComponent.hpp | InjectorGames/Inject | 09e74a83c287b81fd8272c10d6bae2b1aa785c0e | [
"BSD-3-Clause"
] | 2 | 2019-12-10T16:26:58.000Z | 2020-04-17T11:47:42.000Z | Include/Injector/Graphics/GuiEcsComponent.hpp | InjectorGames/Inject | 09e74a83c287b81fd8272c10d6bae2b1aa785c0e | [
"BSD-3-Clause"
] | 28 | 2020-08-17T12:39:50.000Z | 2020-11-16T20:42:50.000Z | Include/Injector/Graphics/GuiEcsComponent.hpp | InjectorGames/InjectorEngine | 09e74a83c287b81fd8272c10d6bae2b1aa785c0e | [
"BSD-3-Clause"
] | null | null | null | #pragma once
#include "Injector/ECS/EcsComponent.hpp"
#include "Injector/Graphics/GuiHandler.hpp"
#include <memory>
namespace Injector
{
struct GuiEcsComponent final : public EcsComponent
{
std::shared_ptr<GuiHandler> handler;
explicit GuiEcsComponent(
const std::shared_ptr<GuiHandler>& handler) noexcept;
};
}
| 19.117647 | 56 | 0.766154 |
6758192828c4f203007fa1f44776bac51d254ef4 | 6,528 | dart | Dart | flutter/sample/lib/widgets/faraboom_authenticator.dart | xclud/docker-images-flutter | 5505e86dea66711be80d4a248854257ace5fa7aa | [
"MIT"
] | 1 | 2021-12-04T22:04:27.000Z | 2021-12-04T22:04:27.000Z | flutter/sample/lib/widgets/faraboom_authenticator.dart | xclud/docker-images-flutter | 5505e86dea66711be80d4a248854257ace5fa7aa | [
"MIT"
] | null | null | null | flutter/sample/lib/widgets/faraboom_authenticator.dart | xclud/docker-images-flutter | 5505e86dea66711be80d4a248854257ace5fa7aa | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:novinpay/app_state.dart';
import 'package:novinpay/colors.dart' as colors;
import 'package:novinpay/mixins/bank_login.dart';
import 'package:novinpay/routes.dart' as routes;
import 'package:novinpay/strings.dart' as strings;
import 'package:novinpay/sun.dart';
class FaraboomAuthenticator extends StatefulWidget {
//final FaraboomLoginController controller;
FaraboomAuthenticator({
@required this.child,
@required this.route,
});
final Widget child;
final String route;
@override
State<StatefulWidget> createState() => _FaraboomAuthenticatorState();
}
class _FaraboomAuthenticatorState extends State<FaraboomAuthenticator>
with BankLogin {
String state;
String code;
int _page;
bool _loading = false;
bool _isError = false;
String _errorText;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
await _processArgs();
_checkLogin();
});
}
void _checkLogin() async {
final login = await appState.getBankLoginInfo();
if (login.code == null || login.state == null || login.expires == null) {
_showDialog();
return;
}
final now = DateTime.now().millisecondsSinceEpoch;
if (now >= login.expires) {
_showDialog();
}
}
void _showDialog() {
bool _allowPop = false;
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return WillPopScope(
onWillPop: () => Future.value(_allowPop),
child: AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'کاربر گرامی، انجام عملیات بانکی نیازمند احراز هویت در سامانه بانکی است',
),
SizedBox(
height: 16,
),
Row(
children: [
Expanded(
child: RaisedButton(
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(
'ورود به بانک',
style: colors
.boldStyle(context)
.copyWith(color: Colors.white),
),
),
onPressed: () async {
final result = await ensureBankLogin(widget.route);
if (result != null) {
_allowPop = true;
Navigator.of(context).pop();
}
},
),
),
SizedBox(
width: 16,
),
Expanded(
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: colors.ternaryColor, width: 2)),
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(
'انصراف',
style: colors
.regularStyle(context)
.copyWith(color: colors.ternaryColor),
),
),
onPressed: () {
_allowPop = true;
Navigator.of(context).pop();
Navigator.of(context).pushReplacementNamed(
routes.home,
arguments: {'selectedPage': _page ?? 2});
},
),
)
],
),
],
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0),
),
),
);
});
}
Future<void> _processArgs() async {
final args = ModalRoute.of(context).settings.arguments;
if (args == null) {
return;
}
if (args is Map<String, Object>) {
final state = int.tryParse(args['state']?.toString() ?? '');
final code = args['code'] as String;
final page = args['selectedPage'];
if (page != null && page is int) {
_page = page;
}
if (state == null || code == null || code.isEmpty) {
return;
}
setState(() {
_loading = true;
});
final data = await nh.boomMarket.boomToken(
state: state,
code: code,
);
if (!mounted) {
return;
}
setState(() {
_loading = false;
});
if (data.isError) {
setState(() {
_isError = true;
_errorText = data.error;
});
return;
}
if (data.content?.status != true) {
setState(() {
_isError = true;
_errorText = data.content.description;
});
return;
}
setState(() {
_isError = false;
_errorText = null;
});
final now = DateTime.now().millisecondsSinceEpoch - 100;
await appState.setBankLoginInfo(
state,
code,
now + data.content.expires * 1000.0,
);
}
}
@override
Widget build(BuildContext context) {
final children = <Widget>[];
if (_isError) {
children.add(Icon(
Icons.error_outline,
color: Colors.red,
size: 48,
));
children.add(SizedBox(height: 8));
children.add(Text(_errorText ?? ''));
} else {
children.add(CircularProgressIndicator());
children.add(SizedBox(height: 8));
children.add(Text(strings.please_wait));
}
final x = Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: children,
),
);
if (_loading) {
return x;
}
if (_isError) {
return x;
}
return widget.child;
}
}
| 27.2 | 93 | 0.458793 |
70fed6b8ed0b36b121af66cdb8d56282c19aeb88 | 739 | cs | C# | src/MyChat.Infra.Data/Context/MyChatDbContext.cs | vitordm/my-chat-project | 612c5d5b4009b8ace5d08b58c99c5e4b9ed29cbe | [
"MIT"
] | null | null | null | src/MyChat.Infra.Data/Context/MyChatDbContext.cs | vitordm/my-chat-project | 612c5d5b4009b8ace5d08b58c99c5e4b9ed29cbe | [
"MIT"
] | null | null | null | src/MyChat.Infra.Data/Context/MyChatDbContext.cs | vitordm/my-chat-project | 612c5d5b4009b8ace5d08b58c99c5e4b9ed29cbe | [
"MIT"
] | null | null | null | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using MyChat.Domain.Auth;
using MyChat.Domain.Entities;
namespace MyChat.Infra.Data.Context
{
public class MyChatDbContext : IdentityDbContext<AppUser, AppRole, long>
{
public virtual DbSet<ChatMessage> ChatMessages { get; set; }
public MyChatDbContext(DbContextOptions options) : base(options)
{
}
protected MyChatDbContext()
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(MyChatDbContext).Assembly);
}
}
}
| 25.482759 | 91 | 0.691475 |
f041e98c571c26af4c01ecd0f0cfa92f16b6b7b4 | 2,216 | ps1 | PowerShell | PSDataConduIT/Public/Get-Timezone.ps1 | bpfoley45/PSDataConduIT | 0e82b51113c1c10f94540bc302c93e8a89e50a38 | [
"MIT"
] | null | null | null | PSDataConduIT/Public/Get-Timezone.ps1 | bpfoley45/PSDataConduIT | 0e82b51113c1c10f94540bc302c93e8a89e50a38 | [
"MIT"
] | null | null | null | PSDataConduIT/Public/Get-Timezone.ps1 | bpfoley45/PSDataConduIT | 0e82b51113c1c10f94540bc302c93e8a89e50a38 | [
"MIT"
] | null | null | null | <#
.SYNOPSIS
Gets a timezone.
.DESCRIPTION
Gets all timezones or a single timezone if a timezone id is specified.
If the result return null, try the parameter "-Verbose" to get more details.
.EXAMPLE
Get-Timezone
TimezoneID Name
---------- ----
1 Never
2 Always
0 Not Used
.LINK
https://github.com/erwindevreugd/PSDataConduIT
#>
function Get-Timezone
{
[CmdletBinding()]
param
(
[Parameter(
Position=0,
Mandatory=$false,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The name of the server where the DataConduIT service is running or localhost.')]
[string]$Server = $Script:Server,
[Parameter(
Position=1,
Mandatory=$false,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The credentials used to authenticate the user to the DataConduIT service.')]
[PSCredential]$Credential = $Script:Credential,
[Parameter(
Mandatory=$false,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The timezone id parameter.')]
[int]$TimezoneID
)
process {
$query = "SELECT * FROM Lnl_Timezone WHERE __CLASS='Lnl_Timezone'"
if($TimezoneID) {
$query += " AND ID=$TimezoneID"
}
LogQuery $query
$parameters = @{
ComputerName=$Server;
Namespace=$Script:OnGuardNamespace;
Query=$query
}
if($Credential -ne $null) {
$parameters.Add("Credential", $Credential)
}
Get-WmiObject @parameters | ForEach-Object { New-Object PSObject -Property @{
Class=$_.__CLASS;
SuperClass=$_.__SUPERCLASS;
Server=$_.__SERVER;
ComputerName=$_.__SERVER;
Path=$_.__PATH;
Credential=$Credential;
TimezoneID=$_.ID;
Name=$_.Name;
SegmentID=$_.SegmentID;
} | Add-ObjectType -TypeName "DataConduIT.LnlTimezone"
}
}
} | 27.358025 | 105 | 0.541516 |
50afa1d5ae9231a9ed48d817f4d9fab623cd6ee2 | 648 | go | Go | adder/full_test.go | efreitasn/go-logic | fb4010ede6919957c27cf5c5328e3605bda488b7 | [
"MIT"
] | null | null | null | adder/full_test.go | efreitasn/go-logic | fb4010ede6919957c27cf5c5328e3605bda488b7 | [
"MIT"
] | null | null | null | adder/full_test.go | efreitasn/go-logic | fb4010ede6919957c27cf5c5328e3605bda488b7 | [
"MIT"
] | null | null | null | package adder
import (
"fmt"
"testing"
)
func TestFull(t *testing.T) {
truthTable := []struct {
a uint8
b uint8
cIn uint8
cOut uint8
s uint8
}{
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 1},
{0, 1, 0, 0, 1},
{0, 1, 1, 1, 0},
{1, 0, 0, 0, 1},
{1, 0, 1, 1, 0},
{1, 1, 0, 1, 0},
{1, 1, 1, 1, 1},
}
for _, row := range truthTable {
t.Run(fmt.Sprintf("%v_%v_%v", row.a, row.b, row.cIn), func(t *testing.T) {
cOut, s := Full(row.a, row.b, row.cIn)
if cOut != row.cOut {
t.Errorf("got %v as cOut, want %v", cOut, row.cOut)
}
if s != row.s {
t.Errorf("got %v as s, want %v", s, row.s)
}
})
}
}
| 16.2 | 76 | 0.475309 |
8605665ac01a6aaa1425f19faf420eeaa16175ed | 3,924 | java | Java | server/src/main/java/com/chutneytesting/design/infra/storage/compose/OrientComposableTestCaseMapper.java | PKode/chutney | a695675cb67bb2ffb4441f9c430c454802e2c122 | [
"Apache-2.0"
] | null | null | null | server/src/main/java/com/chutneytesting/design/infra/storage/compose/OrientComposableTestCaseMapper.java | PKode/chutney | a695675cb67bb2ffb4441f9c430c454802e2c122 | [
"Apache-2.0"
] | null | null | null | server/src/main/java/com/chutneytesting/design/infra/storage/compose/OrientComposableTestCaseMapper.java | PKode/chutney | a695675cb67bb2ffb4441f9c430c454802e2c122 | [
"Apache-2.0"
] | null | null | null | package com.chutneytesting.design.infra.storage.compose;
import static com.chutneytesting.design.domain.compose.ComposableTestCaseRepository.COMPOSABLE_TESTCASE_REPOSITORY_SOURCE;
import static com.chutneytesting.design.infra.storage.compose.OrientFunctionalStepMapper.buildFunctionalStepsChildren;
import static com.chutneytesting.design.infra.storage.compose.OrientFunctionalStepMapper.setFunctionalStepVertexDenotations;
import static com.chutneytesting.design.infra.storage.db.orient.OrientComponentDB.TESTCASE_CLASS_PROPERTY_CREATIONDATE;
import static com.chutneytesting.design.infra.storage.db.orient.OrientComponentDB.TESTCASE_CLASS_PROPERTY_DESCRIPTION;
import static com.chutneytesting.design.infra.storage.db.orient.OrientComponentDB.TESTCASE_CLASS_PROPERTY_PARAMETERS;
import static com.chutneytesting.design.infra.storage.db.orient.OrientComponentDB.TESTCASE_CLASS_PROPERTY_TAGS;
import static com.chutneytesting.design.infra.storage.db.orient.OrientComponentDB.TESTCASE_CLASS_PROPERTY_TITLE;
import static com.chutneytesting.design.infra.storage.db.orient.OrientUtils.setOnlyOnceProperty;
import static com.chutneytesting.design.infra.storage.db.orient.OrientUtils.setOrRemoveProperty;
import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.OVertex;
import com.chutneytesting.design.domain.compose.ComposableScenario;
import com.chutneytesting.design.domain.compose.ComposableTestCase;
import com.chutneytesting.design.domain.compose.FunctionalStep;
import com.chutneytesting.design.domain.scenario.TestCaseMetadata;
import com.chutneytesting.design.domain.scenario.TestCaseMetadataImpl;
import java.util.Date;
import java.util.List;
import java.util.Map;
class OrientComposableTestCaseMapper {
static void testCaseToVertex(final ComposableTestCase composableTestCase, OVertex dbTestCase, ODatabaseSession dbSession) {
dbTestCase.setProperty(TESTCASE_CLASS_PROPERTY_TITLE, composableTestCase.metadata.title(), OType.STRING);
setOrRemoveProperty(dbTestCase, TESTCASE_CLASS_PROPERTY_DESCRIPTION, composableTestCase.metadata.description(), OType.STRING);
setOnlyOnceProperty(dbTestCase, TESTCASE_CLASS_PROPERTY_CREATIONDATE, Date.from(composableTestCase.metadata.creationDate()), OType.DATETIME);
dbTestCase.setProperty(TESTCASE_CLASS_PROPERTY_TAGS, composableTestCase.metadata.tags(), OType.EMBEDDEDLIST);
setOrRemoveProperty(dbTestCase, TESTCASE_CLASS_PROPERTY_PARAMETERS, composableTestCase.composableScenario.parameters, OType.EMBEDDEDMAP);
setFunctionalStepVertexDenotations(dbTestCase, composableTestCase.composableScenario.functionalSteps, dbSession);
}
static ComposableTestCase vertexToTestCase(final OVertex dbTestCase, ODatabaseSession dbSession) {
TestCaseMetadata metadata = TestCaseMetadataImpl.builder()
.withId(dbTestCase.getIdentity().toString())
.withTitle(dbTestCase.getProperty(TESTCASE_CLASS_PROPERTY_TITLE))
.withDescription(dbTestCase.getProperty(TESTCASE_CLASS_PROPERTY_DESCRIPTION))
.withCreationDate(((Date)dbTestCase.getProperty(TESTCASE_CLASS_PROPERTY_CREATIONDATE)).toInstant())
.withRepositorySource(COMPOSABLE_TESTCASE_REPOSITORY_SOURCE)
.withTags(dbTestCase.getProperty(TESTCASE_CLASS_PROPERTY_TAGS))
.build();
List<FunctionalStep> functionalStepRefs = buildFunctionalStepsChildren(dbTestCase, dbSession);
Map<String, String> parameters = dbTestCase.getProperty(TESTCASE_CLASS_PROPERTY_PARAMETERS);
return new ComposableTestCase(
dbTestCase.getIdentity().toString(),
metadata,
ComposableScenario.builder()
.withFunctionalSteps(functionalStepRefs)
.withParameters(parameters)
.build());
}
}
| 65.4 | 149 | 0.817533 |
0b5adb9041b96e89affef15661e25d3114bd15aa | 962 | py | Python | play-1.2.4/python/Lib/site-packages/Rpyc/Utils/Discovery.py | AppSecAI-TEST/restcommander | a2523f31356938f5c7fc6d379b7678da0b1e077a | [
"Apache-2.0"
] | 550 | 2015-01-05T16:59:00.000Z | 2022-03-20T16:55:25.000Z | framework/python/Lib/site-packages/Rpyc/Utils/Discovery.py | lafayette/JBTT | 94bde9d90abbb274d29ecd82e632d43a4320876e | [
"MIT"
] | 15 | 2015-02-05T06:00:47.000Z | 2018-07-07T14:34:04.000Z | framework/python/Lib/site-packages/Rpyc/Utils/Discovery.py | lafayette/JBTT | 94bde9d90abbb274d29ecd82e632d43a4320876e | [
"MIT"
] | 119 | 2015-01-08T00:48:24.000Z | 2022-01-27T14:13:15.000Z | """
Discovery: broadcasts a query, attempting to discover all running RPyC servers
over the local network/specific subnet.
"""
import socket
import select
import struct
__all__ = ["discover_servers"]
UDP_DISCOVERY_PORT = 18813
QUERY_MAGIC = "RPYC_QUERY"
MAX_DGRAM_SIZE = 100
def discover_servers(subnet = "255.255.255.255", timeout = 1):
"""broadcasts a query and returns a list of (addr, port) of running servers"""
# broadcast
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto(QUERY_MAGIC, (subnet, UDP_DISCOVERY_PORT))
# wait for replies
replies = []
while True:
rlist, dummy, dummy = select.select([s], [], [], timeout)
if not rlist:
break
data, (addr, port) = s.recvfrom(MAX_DGRAM_SIZE)
rpyc_port, = struct.unpack("<H", data)
replies.append((addr, rpyc_port))
return list(set(replies))
| 24.666667 | 82 | 0.672557 |
19c290a83b8f2ce07a870c549bdf5527db925e9f | 390 | ps1 | PowerShell | generate_proto.ps1 | SteelPh0enix/OrionGRPC | 03a78ac5fec54715ef78cfa695e2e8698dd704d2 | [
"MIT"
] | 1 | 2019-11-19T13:16:39.000Z | 2019-11-19T13:16:39.000Z | generate_proto.ps1 | SteelPh0enix/OrionGRPC | 03a78ac5fec54715ef78cfa695e2e8698dd704d2 | [
"MIT"
] | null | null | null | generate_proto.ps1 | SteelPh0enix/OrionGRPC | 03a78ac5fec54715ef78cfa695e2e8698dd704d2 | [
"MIT"
] | 1 | 2019-12-17T17:59:58.000Z | 2019-12-17T17:59:58.000Z | $ErrorActionPreference = 'silentlycontinue'
mkdir .\OrionServer\proto > $null
mkdir .\RemoteClient\proto > $null
py -m grpc_tools.protoc -I./Protocols --python_out=./OrionServer/proto --grpc_python_out=./OrionServer/proto ./Protocols/Chassis.proto
py -m grpc_tools.protoc -I./Protocols --python_out=./RemoteClient/proto --grpc_python_out=./RemoteClient/proto ./Protocols/Chassis.proto | 65 | 136 | 0.779487 |
2a8549dc5ab543329828e9a5c213e6c3f375ede1 | 123 | java | Java | tcp-mocker-core/src/main/java/io/payworks/labs/tcpmocker/datahandler/DataHandlerType.java | andreea-bogdan/tcp-mocker | 67320fb4ce0aa2ec8877f467281eba6d7eb654db | [
"Apache-2.0"
] | 13 | 2018-12-18T17:59:34.000Z | 2021-08-25T02:44:32.000Z | tcp-mocker-core/src/main/java/io/payworks/labs/tcpmocker/datahandler/DataHandlerType.java | andreea-bogdan/tcp-mocker | 67320fb4ce0aa2ec8877f467281eba6d7eb654db | [
"Apache-2.0"
] | 4 | 2018-12-19T09:07:51.000Z | 2021-03-09T16:41:28.000Z | tcp-mocker-core/src/main/java/io/payworks/labs/tcpmocker/datahandler/DataHandlerType.java | andreea-bogdan/tcp-mocker | 67320fb4ce0aa2ec8877f467281eba6d7eb654db | [
"Apache-2.0"
] | 5 | 2018-12-20T09:13:15.000Z | 2022-01-27T09:44:42.000Z | package io.payworks.labs.tcpmocker.datahandler;
public enum DataHandlerType {
STATIC_HEX_REGEX, DYNAMIC_HEX_REGEX
}
| 15.375 | 47 | 0.804878 |
22cc3f03d4598fdbf6708efaa5a5ecfa617aa1df | 2,344 | cpp | C++ | Engine/Source/Runtime/PacketHandlers/EncryptionComponents/SymmetricEncryption/BlockEncryption/XORBlockEncryptor/Private/XORBlockEncryptor.cpp | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 1 | 2022-01-29T18:36:12.000Z | 2022-01-29T18:36:12.000Z | Engine/Source/Runtime/PacketHandlers/EncryptionComponents/SymmetricEncryption/BlockEncryption/XORBlockEncryptor/Private/XORBlockEncryptor.cpp | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | null | null | null | Engine/Source/Runtime/PacketHandlers/EncryptionComponents/SymmetricEncryption/BlockEncryption/XORBlockEncryptor/Private/XORBlockEncryptor.cpp | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | null | null | null | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "XORBlockEncryptor.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_MODULE(FXORBlockEncryptorModuleInterface, XORBlockEncryptor);
// MODULE INTERFACE
BlockEncryptor* FXORBlockEncryptorModuleInterface::CreateBlockEncryptorInstance()
{
return new XORBlockEncryptor;
}
// XOR BLOCK
void XORBlockEncryptor::Initialize(TArray<uint8>* InKey)
{
Key = InKey;
if (Key->Num() != sizeof(int8) && Key->Num() != sizeof(int16) && Key->Num() != sizeof(int32) && Key->Num() != sizeof(int64))
{
LowLevelFatalError(TEXT("Incorrect key size. %i size chosen"), Key->Num());
}
FixedBlockSize = Key->Num();
}
void XORBlockEncryptor::EncryptBlock(uint8* Block)
{
if (Key->Num() == sizeof(int8))
{
int8 Output = *reinterpret_cast<int8*>(Block) ^ *reinterpret_cast<int8*>(Key->GetData());
memcpy(Block, &Output, sizeof(int8));
}
else if (Key->Num() == sizeof(int16))
{
int16 Output = *reinterpret_cast<int16*>(Block) ^ *reinterpret_cast<int16*>(Key->GetData());
memcpy(Block, &Output, sizeof(int16));
}
else if (Key->Num() == sizeof(int32))
{
int32 Output = *reinterpret_cast<int32*>(Block) ^ *reinterpret_cast<int32*>(Key->GetData());
memcpy(Block, &Output, sizeof(int32));
}
else if (Key->Num() == sizeof(int64))
{
int64 Output = *reinterpret_cast<int64*>(Block) ^ *reinterpret_cast<int64*>(Key->GetData());
memcpy(Block, &Output, sizeof(int64));
}
//UE_LOG(PacketHandlerLog, Log, TEXT("XOR Block Encrypted"));
}
void XORBlockEncryptor::DecryptBlock(uint8* Block)
{
if (Key->Num() == sizeof(int8))
{
int8 Output = *reinterpret_cast<int8*>(Block) ^ *reinterpret_cast<int8*>(Key->GetData());
memcpy(Block, &Output, sizeof(int8));
}
else if (Key->Num() == sizeof(int16))
{
int16 Output = *reinterpret_cast<int16*>(Block) ^ *reinterpret_cast<int16*>(Key->GetData());
memcpy(Block, &Output, sizeof(int16));
}
else if (Key->Num() == sizeof(int32))
{
int32 Output = *reinterpret_cast<int32*>(Block) ^ *reinterpret_cast<int32*>(Key->GetData());
memcpy(Block, &Output, sizeof(int32));
}
else if (Key->Num() == sizeof(int64))
{
int64 Output = *reinterpret_cast<int64*>(Block) ^ *reinterpret_cast<int64*>(Key->GetData());
memcpy(Block, &Output, sizeof(int64));
}
//UE_LOG(PacketHandlerLog, Log, TEXT("XOR Block Decrypted"));
} | 30.051282 | 125 | 0.682594 |
64fe9484766cbc9491ddaf9e2832c25e2920f363 | 4,257 | java | Java | dcwlt-modules/dcwlt-pay-online/src/main/java/com/dcits/dcwlt/pay/online/event/callback/TxEndNTCoreQryCallBack.java | shuwenjin/dcwlt | 97f677cf596b7bcb23ce8867b5a286cce4a82339 | [
"MIT"
] | null | null | null | dcwlt-modules/dcwlt-pay-online/src/main/java/com/dcits/dcwlt/pay/online/event/callback/TxEndNTCoreQryCallBack.java | shuwenjin/dcwlt | 97f677cf596b7bcb23ce8867b5a286cce4a82339 | [
"MIT"
] | null | null | null | dcwlt-modules/dcwlt-pay-online/src/main/java/com/dcits/dcwlt/pay/online/event/callback/TxEndNTCoreQryCallBack.java | shuwenjin/dcwlt | 97f677cf596b7bcb23ce8867b5a286cce4a82339 | [
"MIT"
] | 1 | 2022-03-01T08:24:59.000Z | 2022-03-01T08:24:59.000Z | package com.dcits.dcwlt.pay.online.event.callback;
import com.alibaba.fastjson.JSONObject;
import com.dcits.dcwlt.common.pay.channel.bankcore.dto.BankCore996666.BankCore996666Rsp;
import com.dcits.dcwlt.pay.api.domain.dcep.eventBatch.EventDealRspMsg;
import com.dcits.dcwlt.common.pay.constant.AppConstant;
import com.dcits.dcwlt.pay.api.model.PayTransDtlInfoDO;
import com.dcits.dcwlt.pay.api.model.StateMachine;
import com.dcits.dcwlt.pay.online.event.callback.ReCreditCoreQryCallBack;
import com.dcits.dcwlt.pay.online.service.ICoreProcessService;
import com.dcits.dcwlt.pay.online.event.coreqry.ICoreQryCallBack;
import com.dcits.dcwlt.pay.online.service.IPayTransDtlInfoService;
import com.dcits.dcwlt.pay.online.service.impl.TxEndNtfcntHandleServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 终态通知 220 或 221 回查核心后回调处理
*/
@Component("TxEndNTCoreQryCallBack")
public class TxEndNTCoreQryCallBack implements ICoreQryCallBack {
@Autowired
private TxEndNtfcntHandleServiceImpl handleService;
@Autowired
private IPayTransDtlInfoService payTransDtlInfoRepository;
@Autowired
private ICoreProcessService bankCoreProcessService;
private static final Logger logger = LoggerFactory.getLogger(ReCreditCoreQryCallBack.class);
@Override
public EventDealRspMsg coreSucc(EventDealRspMsg eventDealRspMsg, BankCore996666Rsp bankCore996666Rsp, JSONObject eventParam) {
logger.info("交易兑回终态通知-核心回查-核心状态为成功");
// 220--> 210 或 221--> 211,调推断
txEndNTQryCoreDone(bankCore996666Rsp, eventParam);
return eventDealRspMsg;
}
@Override
public EventDealRspMsg coreFail(EventDealRspMsg eventDealRspMsg, BankCore996666Rsp bankCore996666Rsp, JSONObject eventParam) {
logger.info("交易兑回终态通知-核心回查-核心状态为失败");
// 220--> 200 或 221--> 201,调推断
txEndNTQryCoreDone(bankCore996666Rsp, eventParam);
return eventDealRspMsg;
}
@Override
public EventDealRspMsg coreAbend(EventDealRspMsg eventDealRspMsg, BankCore996666Rsp bankCore996666Rsp, JSONObject eventParam) {
return eventDealRspMsg;
}
@Override
public EventDealRspMsg coreReversed(EventDealRspMsg eventDealRspMsg, BankCore996666Rsp bankCore996666Rsp, JSONObject eventParam) {
return eventDealRspMsg;
}
private void txEndNTQryCoreDone(BankCore996666Rsp bankCore996666Rsp, JSONObject eventParam) {
// TxEndNtfcntHandleService handleService = RtpUtil.getInstance().getBean("txEndNtfcntHandleService");
// IPayTransDtlInfoRepository payTransDtlInfoRepository = RtpUtil.getInstance().getBean("payTransDtlInfoRepository");
// ICoreProcessService bankCoreProcessService = RtpUtil.getInstance().getBean("bankCoreProcessService");
String payDate = eventParam.getString("payDate");
String paySerno = eventParam.getString("paySerno");
//查询原交易状态
PayTransDtlInfoDO payTransDtlInfoDO = payTransDtlInfoRepository.query(payDate,paySerno);
String trxStatus = payTransDtlInfoDO.getTrxStatus();
String coreProcStatus = payTransDtlInfoDO.getCoreProcStatus();
String pathProcStatus = payTransDtlInfoDO.getPathProcStatus();
StateMachine stateMachine = new StateMachine();
stateMachine.setPreTrxStatus(trxStatus);
stateMachine.setPreCoreProcStatus(coreProcStatus);
stateMachine.setPrePathProcStatus(pathProcStatus);
boolean status221 = (AppConstant.TRXSTATUS_ABEND.equals(trxStatus)
&& AppConstant.CORESTATUS_ABEND.equals(coreProcStatus)
&& AppConstant.PAYPATHSTATUS_SUCCESS.equals(pathProcStatus));
boolean status220 = (AppConstant.TRXSTATUS_ABEND.equals(trxStatus)
&& AppConstant.CORESTATUS_ABEND.equals(coreProcStatus)
&& AppConstant.PAYPATHSTATUS_FAILED.equals(pathProcStatus));
if(status221 || status220){
//核心状态修改
bankCoreProcessService.qryCoreStsRetDone(payTransDtlInfoDO,bankCore996666Rsp,stateMachine);
//调用兑回推断
handleService.reconvertInferenceHandle(payDate,paySerno);
}
}
}
| 40.932692 | 134 | 0.760395 |
06e8b690879600b5b476e8f37dca9e63d69d572b | 82,227 | asm | Assembly | bios_source/bios.asm | alblue/8086tiny | b61d7852e5868330c5776d9fdc3125ede21cbc84 | [
"MIT"
] | 26 | 2016-06-05T16:01:05.000Z | 2022-02-06T18:28:18.000Z | bios_source/bios.asm | graydon/8086tiny | abf0da52891ae1335d1f02a4b83c7a325e0bf467 | [
"MIT"
] | null | null | null | bios_source/bios.asm | graydon/8086tiny | abf0da52891ae1335d1f02a4b83c7a325e0bf467 | [
"MIT"
] | 8 | 2017-02-08T10:40:06.000Z | 2022-01-16T20:28:42.000Z | ; BIOS source for 8086tiny IBM PC emulator. Compiles with NASM.
; Copyright 2013, Adrian Cable (adrian.cable@gmail.com) - http://www.megalith.co.uk/8086tiny
;
; Revision 1.20
;
; This work is licensed under the MIT License. See included LICENSE.TXT.
cpu 8086
; Defines
%define biosbase 0x000f ; BIOS loads at segment 0xF000
; Here we define macros for some custom instructions that help the emulator talk with the outside
; world. They are described in detail in the hint.html file, which forms part of the emulator
; distribution.
%macro extended_putchar_al 0
db 0x0f
db 0x00
%endmacro
%macro extended_get_rtc 0
db 0x0f
db 0x01
%endmacro
%macro extended_read_disk 0
db 0x0f
db 0x02
%endmacro
%macro extended_write_disk 0
db 0x0f
db 0x03
%endmacro
org 100h ; BIOS loads at offset 0x0100
main:
jmp bios_entry
; Here go pointers to the different data tables used for instruction decoding
dw rm_mode12_reg1 ; Table 0: R/M mode 1/2 "register 1" lookup
dw biosbase
dw rm_mode12_reg2 ; Table 1: R/M mode 1/2 "register 2" lookup
dw biosbase
dw rm_mode12_disp ; Table 2: R/M mode 1/2 "DISP multiplier" lookup
dw biosbase
dw rm_mode12_dfseg ; Table 3: R/M mode 1/2 "default segment" lookup
dw biosbase
dw rm_mode0_reg1 ; Table 4: R/M mode 0 "register 1" lookup
dw biosbase
dw rm_mode0_reg2 ; Table 5: R/M mode 0 "register 2" lookup
dw biosbase
dw rm_mode0_disp ; Table 6: R/M mode 0 "DISP multiplier" lookup
dw biosbase
dw rm_mode0_dfseg ; Table 7: R/M mode 0 "default segment" lookup
dw biosbase
dw xlat_ids ; Table 8: Translation of raw opcode index ("Raw ID") to function number ("Xlat'd ID")
dw biosbase
dw 0 ; Table 9: (Defunct)
dw biosbase
dw 0 ; Table 10: (Defunct)
dw biosbase
dw 0 ; Table 11: (Defunct)
dw biosbase
dw 0 ; Table 12: (Defunct)
dw biosbase
dw 0 ; Table 13: (Defunct)
dw biosbase
dw ex_data ; Table 14: Translation of Raw ID to Extra Data
dw biosbase
dw std_szp ; Table 15: Translation of Raw ID to SZP flags set yes/no
dw biosbase
dw std_ao ; Table 16: Translation of Raw ID to AO flags set yes/no
dw biosbase
dw std_o0c0 ; Table 17: Translation of Raw ID to OF=0 CF=0 set yes/no
dw biosbase
dw base_size ; Table 18: Translation of Raw ID to base instruction size (bytes)
dw biosbase
dw i_w_adder ; Table 19: Translation of Raw ID to i_w size adder yes/no
dw biosbase
dw i_mod_adder ; Table 20: Translation of Raw ID to i_mod size adder yes/no
dw biosbase
dw jxx_dec_a ; Table 21: Jxx decode table A
dw biosbase
dw jxx_dec_b ; Table 22: Jxx decode table B
dw biosbase
dw jxx_dec_c ; Table 23: Jxx decode table C
dw biosbase
dw jxx_dec_d ; Table 24: Jxx decode table D
dw biosbase
dw flags_mult ; Table 25: FLAGS multipliers
dw biosbase
dw daa_rslt_ca00 ; Table 26: DAA result, CF = 0, AF = 0
dw biosbase
dw daa_cf_ca00_ca01_das_cf_ca00 ; Table 27: DAA CF out, CF = 0, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 28: DAA AF out, CF = 0, AF = 0
dw biosbase
dw daa_rslt_ca01 ; Table 29: DAA result, CF = 0, AF = 1
dw biosbase
dw daa_cf_ca00_ca01_das_cf_ca00 ; Table 30: DAA CF out, CF = 0, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 31: DAA AF out, CF = 0, AF = 1
dw biosbase
dw daa_rslt_ca10 ; Table 32: DAA result, CF = 1, AF = 0
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 33: DAA CF out, CF = 1, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 34: DAA AF out, CF = 1, AF = 0
dw biosbase
dw daa_rslt_ca11 ; Table 35: DAA result, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 36: DAA CF out, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 37: DAA AF out, CF = 1, AF = 1
dw biosbase
dw das_rslt_ca00 ; Table 38: DAS result, CF = 0, AF = 0
dw biosbase
dw daa_cf_ca00_ca01_das_cf_ca00 ; Table 39: DAS CF out, CF = 0, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 40: DAS AF out, CF = 0, AF = 0
dw biosbase
dw das_rslt_ca01 ; Table 41: DAS result, CF = 0, AF = 1
dw biosbase
dw das_cf_ca01 ; Table 42: DAS CF out, CF = 0, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 43: DAS AF out, CF = 0, AF = 1
dw biosbase
dw das_rslt_ca10 ; Table 44: DAS result, CF = 1, AF = 0
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 45: DAS CF out, CF = 1, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 46: DAS AF out, CF = 1, AF = 0
dw biosbase
dw das_rslt_ca11 ; Table 47: DAS result, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 48: DAS CF out, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 49: DAS AF out, CF = 1, AF = 1
dw biosbase
dw parity ; Table 50: Parity flag loop-up table (256 entries)
dw biosbase
dw i_opcodes ; Table 51: 8-bit opcode lookup table
dw biosbase
; These values (BIOS ID string, BIOS date and so forth) go at the very top of memory
biosstr db '8086tiny BIOS Revision 1.10!', 0, 0 ; Why not?
mem_top db 0xea, 0, 0x01, 0, 0xf0, '01/11/14', 0, 0xfe, 0
bios_entry:
; Set up initial stack to F000:F000
mov sp, 0xf000
mov ss, sp
push cs
pop es
push ax
; The emulator requires a few control registers in memory to always be zero for correct
; instruction decoding (in particular, register look-up operations). These are the
; emulator's zero segment (ZS) and always-zero flag (XF). Because the emulated memory
; space is uninitialised, we need to be sure these values are zero before doing anything
; else. The instructions we need to use to set them must not rely on look-up operations.
; So e.g. MOV to memory is out but string operations are fine.
cld
xor ax, ax
mov di, 24
stosw ; Set ZS = 0
mov di, 49
stosb ; Set XF = 0
; Now we can do whatever we want!
; Set up Hercules graphics support. We start with the adapter in text mode
push dx
mov dx, 0x3b8
mov al, 0
out dx, al ; Set Hercules support to text mode
mov dx, 0 ; The IOCCC version of the emulator also uses I/O port 0 as a graphics mode flag
out dx, al
mov dx, 0x3b4
mov al, 1 ; Hercules CRTC "horizontal displayed" register select
out dx, al
mov dx, 0x3b5
mov al, 0x2d ; 0x2D = 45 (* 16) = 720 pixels wide (GRAPHICS_X)
out dx, al
mov dx, 0x3b4
mov al, 6 ; Hercules CRTC "vertical displayed" register select
out dx, al
mov dx, 0x3b5
mov al, 0x57 ; 0x57 = 87 (* 4) = 348 pixels high (GRAPHICS_Y)
out dx, al
pop dx
pop ax
; Check cold boot/warm boot. We initialise disk parameters on cold boot only
cmp byte [cs:boot_state], 0 ; Cold boot?
jne boot
mov byte [cs:boot_state], 1 ; Set flag so next boot will be warm boot
; First, set up the disk subsystem. Only do this on the very first startup, when
; the emulator sets up the CX/AX registers with disk information.
; Compute the cylinder/head/sector count for the HD disk image, if present.
; Total number of sectors is in CX:AX, or 0 if there is no HD image. First,
; we put it in DX:CX.
mov dx, cx
mov cx, ax
mov [cs:hd_secs_hi], dx
mov [cs:hd_secs_lo], cx
cmp cx, 0
je maybe_no_hd
mov word [cs:num_disks], 2
jmp calc_hd
maybe_no_hd:
cmp dx, 0
je no_hd
mov word [cs:num_disks], 2
jmp calc_hd
no_hd:
mov word [cs:num_disks], 1
calc_hd:
mov ax, cx
mov word [cs:hd_max_track], 1
mov word [cs:hd_max_head], 1
cmp dx, 0 ; More than 63 total sectors? If so, we have more than 1 track.
ja sect_overflow
cmp ax, 63
ja sect_overflow
mov [cs:hd_max_sector], ax
jmp calc_heads
sect_overflow:
mov cx, 63 ; Calculate number of tracks
div cx
mov [cs:hd_max_track], ax
mov word [cs:hd_max_sector], 63
calc_heads:
mov dx, 0 ; More than 1024 tracks? If so, we have more than 1 head.
mov ax, [cs:hd_max_track]
cmp ax, 1024
ja track_overflow
jmp calc_end
track_overflow:
mov cx, 1024
div cx
mov [cs:hd_max_head], ax
mov word [cs:hd_max_track], 1024
calc_end:
; Convert number of tracks into maximum track (0-based) and then store in INT 41
; HD parameter table
mov ax, [cs:hd_max_head]
mov [cs:int41_max_heads], al
mov ax, [cs:hd_max_track]
mov [cs:int41_max_cyls], ax
mov ax, [cs:hd_max_sector]
mov [cs:int41_max_sect], al
dec word [cs:hd_max_track]
dec word [cs:hd_max_head]
; Main BIOS entry point. Zero the flags, and set up registers.
boot: mov ax, 0
push ax
popf
push cs
push cs
pop ds
pop ss
mov sp, 0xf000
; Set up the IVT. First we zero out the table
cld
mov ax, 0
mov es, ax
mov di, 0
mov cx, 512
rep stosw
; Then we load in the pointers to our interrupt handlers
mov di, 0
mov si, int_table
mov cx, [itbl_size]
rep movsb
; Set pointer to INT 41 table for hard disk
mov cx, int41
mov word [es:4*0x41], cx
mov cx, 0xf000
mov word [es:4*0x41 + 2], cx
; Set up last 16 bytes of memory, including boot jump, BIOS date, machine ID byte
mov ax, 0xffff
mov es, ax
mov di, 0x0
mov si, mem_top
mov cx, 16
rep movsb
; Set up the BIOS data area
mov ax, 0x40
mov es, ax
mov di, 0
mov si, bios_data
mov cx, 0x100
rep movsb
; Clear video memory
mov ax, 0xb800
mov es, ax
mov di, 0
mov cx, 80*25
mov ax, 0x0700
rep stosw
; Set up some I/O ports, between 0 and FFF. Most of them we set to 0xFF, to indicate no device present
mov dx, 0
mov al, 0xFF
next_out:
inc dx
cmp dx, 0x40 ; We deal with the PIT channel 0 later
je next_out
cmp dx, 0x3B8 ; We deal with the Hercules port later, too
je next_out
out dx, al
cmp dx, 0xFFF
jl next_out
mov dx, 0x3DA ; CGA refresh port
mov al, 0
out dx, al
mov dx, 0x3BA ; Hercules detection port
mov al, 0
out dx, al
mov dx, 0x3B8 ; Hercules video mode port
mov al, 0
out dx, al
mov dx, 0x3BC ; LPT1
mov al, 0
out dx, al
mov dx, 0x40 ; PIT channel 0
mov al, 0
out dx, al
mov dx, 0x62 ; PPI - needed for memory parity checks
mov al, 0
out dx, al
; Read boot sector from FDD, and load it into 0:7C00
mov ax, 0
mov es, ax
mov ax, 0x0201
mov dx, 0 ; Read from FDD
mov cx, 1
mov bx, 0x7c00
int 13h
; Jump to boot sector
jmp 0:0x7c00
; ************************* INT 7h handler - keyboard driver
int7: ; Whenever the user presses a key, INT 7 is called by the emulator.
; ASCII character of the keystroke is at 0040:this_keystroke
push ds
push es
push ax
push bx
push bp
push cs
pop ds
mov bx, 0x40 ; Set segment to BIOS data area segment (0x40)
mov es, bx
; Tail of the BIOS keyboard buffer goes in BP. This is where we add new keystrokes
mov bp, [es:kbbuf_tail-bios_data]
; First, copy zero keystroke to BIOS keyboard buffer - if we have an extended code then we
; don't translate to a keystroke. If not, then this zero will later be overwritten
; with the actual ASCII code of the keystroke.
mov byte [es:bp], 0
; Retrieve the keystroke
mov al, [es:this_keystroke-bios_data]
cmp al, 0x7f ; Linux code for backspace - change to 8
jne after_check_bksp
mov al, 8
mov byte [es:this_keystroke-bios_data], 8
after_check_bksp:
cmp al, 0x01 ; Ctrl+A pressed - this is the sequence for "next key is Alt+"
jne i2_not_alt
mov byte [es:keyflags1-bios_data], 8 ; Alt flag down
mov byte [es:keyflags2-bios_data], 2 ; Alt flag down
mov al, 0x38 ; Simulated Alt by Ctrl+A prefix?
out 0x60, al
int 9
mov byte [es:next_key_alt-bios_data], 1
jmp i2_dne
i2_not_alt:
cmp al, 0x06 ; Ctrl+F pressed - this is the sequence for "next key is Fxx"
jne i2_not_fn
mov byte [es:next_key_fn-bios_data], 1
jmp i2_dne
i2_not_fn:
cmp byte [es:notranslate_flg-bios_data], 1 ; If no translation mode is on, just pass through the scan code.
mov byte [es:notranslate_flg-bios_data], 0
je after_translate
cmp al, 0xe0 ; Some OSes return scan codes after 0xE0 for things like cursor moves. So, if we find it, set a flag saying the next code received should not be translated.
mov byte [es:notranslate_flg-bios_data], 1
; je after_translate
je i2_dne ; Don't add the 0xE0 to the keyboard buffer
mov byte [es:notranslate_flg-bios_data], 0
cmp al, 0x1b ; ESC key pressed. Either this a "real" escape, or it is UNIX cursor keys. In either case, we do nothing now, except set a flag
jne i2_escnext
; If the last key pressed was ESC, then we need to stuff it
cmp byte [es:escape_flag-bios_data], 1
jne i2_sf
; Stuff an ESC character
mov byte [es:bp], 0x1b ; ESC ASCII code
mov byte [es:bp+1], 0x01 ; ESC scan code
; ESC keystroke is in the buffer now
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
mov al, 0x01
call keypress_release
i2_sf:
mov byte [es:escape_flag-bios_data], 1
jmp i2_dne
i2_escnext:
; Check if the last key was an escape character
cmp byte [es:escape_flag-bios_data], 1
jne i2_noesc
; It is, so check if this key is a ] character
cmp al, '[' ; [ key pressed
je i2_esc
; It isn't, so stuff an ESC character plus this key
mov byte [es:bp], 0x1b ; ESC ASCII code
mov byte [es:bp+1], 0x01 ; ESC scan code
; ESC keystroke is in the buffer now
add bp, 2
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
mov al, 0x01
call keypress_release
; Now actually process this key
mov byte [es:escape_flag-bios_data], 0
mov al, [es:this_keystroke-bios_data]
jmp i2_noesc
i2_esc:
; Last + this characters are ESC ] - do nothing now, but set escape flag
mov byte [es:escape_flag-bios_data], 2
jmp i2_dne
i2_noesc:
cmp byte [es:escape_flag-bios_data], 2
jne i2_regular_key
; No shifts or Alt for cursor keys
mov byte [es:keyflags1-bios_data], 0
mov byte [es:keyflags2-bios_data], 0
; Last + this characters are ESC ] xxx - cursor key, so translate and stuff it
cmp al, 'A'
je i2_cur_up
cmp al, 'B'
je i2_cur_down
cmp al, 'D'
je i2_cur_left
cmp al, 'C'
je i2_cur_right
i2_cur_up:
mov al, 0x48 ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_cur_down:
mov al, 0x50 ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_cur_left:
mov al, 0x4b ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_cur_right:
mov al, 0x4d ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_regular_key:
mov byte [es:notranslate_flg-bios_data], 0
mov bx, a2shift_tbl ; ASCII to shift code table
xlat
; Now, AL is 1 if shift is down, 0 otherwise. If shift is down, put a shift down scan code
; in port 0x60. Then call int 9. Otherwise, put a shift up scan code in, and call int 9.
push ax
; Put shift flags in BIOS, 0040:0017. Add 8 to shift flags if Alt is down.
mov ah, [es:next_key_alt-bios_data]
cpu 186
shl ah, 3
cpu 8086
add al, ah
mov [es:keyflags1-bios_data], al
cpu 186
shr ah, 2
cpu 8086
mov [es:keyflags2-bios_data], ah
pop ax
test al, 1
jz i2_n
mov al, 0x36 ; Right shift down
out 0x60, al
int 9
i2_n:
mov al, [es:this_keystroke-bios_data]
mov [es:bp], al
mov bx, a2scan_tbl ; ASCII to scan code table
xlat
cmp byte [es:next_key_fn-bios_data], 1 ; Fxx?
jne after_translate
mov byte [es:bp], 0 ; Fxx key, so zero out ASCII code
add al, 0x39
after_translate:
mov byte [es:escape_flag-bios_data], 0
mov byte [es:escape_flag_last-bios_data], 0
; Now, AL contains the scan code of the key. Put it in the buffer
mov [es:bp+1], al
; New keystroke + scancode is in the buffer now. If the key is actually
; an Alt+ key we use an ASCII code of 0 instead of the real value.
cmp byte [es:next_key_alt-bios_data], 1
jne skip_ascii_zero
mov byte [es:bp], 0
skip_ascii_zero:
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
; Output key down/key up event (scancode in AL) to keyboard port
call keypress_release
; If scan code is not 0xE0, then also send right shift up
cmp al, 0xe0
je i2_dne
mov al, 0xb6 ; Right shift up
out 0x60, al
int 9
check_alt:
mov al, byte [es:next_key_alt-bios_data]
mov byte [es:next_key_alt-bios_data], 0
mov byte [es:next_key_fn-bios_data], 0
cmp al, 1
je endalt
jmp i2_dne
endalt:
mov al, 0xb8 ; Left Alt up
out 0x60, al
int 9
i2_dne:
pop bp
pop bx
pop ax
pop es
pop ds
iret
; ************************* INT 8h handler - timer
int8:
; See if there is an ESC waiting from a previous INT 2h. If so, put it in the keyboard buffer
; (because by now - 1/18.2 secs on - we know it can't be part of an escape key sequence).
; Also handle CGA refresh register. Also release any keys that are still marked as down.
push ax
push bx
push dx
push bp
push es
push cx
push di
push ds
push si
call vmem_driver_entry ; CGA text mode driver - documented later
mov bx, 0x40
mov es, bx
; Increment 32-bit BIOS timer tick counter, once every 8 calls
cmp byte [cs:int8_call_cnt], 8
jne skip_timer_increment
add word [es:0x6C], 1
adc word [es:0x6E], 0
mov byte [cs:int8_call_cnt], 0
skip_timer_increment:
inc byte [cs:int8_call_cnt]
; A Hercules graphics adapter flips bit 7 of I/O port 3BA, every now and then, apparently!
mov dx, 0x3BA
in al, dx
xor al, 0x80
out dx, al
; We now need to convert the data in I/O port 0x3B8 (Hercules settings) to a new format in
; I/O port 0, which we use in the IOCCC version of the emulator for code compactness.
; Basically this port will contain 0 if the Hercules graphics is disabled, 2 otherwise. Note,
; this is not used in 8086tiny.
mov dx, 0x3B8
in al, dx
test al, 2
jnz herc_gfx_mode
; Hercules is in text mode, so set I/O port 0 to 0
mov al, 0
jmp io_init_continue
herc_gfx_mode:
mov al, 2
io_init_continue:
mov dx, 0
out dx, al
; See if we have any keys down. If so, release them
cmp byte [es:key_now_down-bios_data], 0
je i8_no_key_down
mov al, [es:key_now_down-bios_data]
mov byte [es:key_now_down-bios_data], 0
add al, 0x80
out 0x60, al
int 9
i8_no_key_down:
; See if we have a waiting ESC flag
cmp byte [es:escape_flag-bios_data], 1
jne i8_end
; Did we have one last two cycles as well?
cmp byte [es:escape_flag_last-bios_data], 1
je i8_stuff_esc
inc byte [es:escape_flag_last-bios_data]
jmp i8_end
i8_stuff_esc:
; Yes, clear the ESC flag and put it in the keyboard buffer
mov byte [es:escape_flag-bios_data], 0
mov byte [es:escape_flag_last-bios_data], 0
mov bp, [es:kbbuf_tail-bios_data]
mov byte [es:bp], 0x1b ; ESC ASCII code
mov byte [es:bp+1], 0x01 ; ESC scan code
; ESC keystroke is in the buffer now
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
; Push out ESC keypress/release
mov al, 0x01
call keypress_release
i8_end:
; Now, reset emulated PIC
; mov al, 0
; mov dx, 0x20
; out dx, al
pop si
pop ds
pop di
pop cx
pop es
pop bp
pop dx
pop bx
pop ax
int 0x1c
iret
; ************************* INT 10h handler - video services
int10:
cmp ah, 0x00 ; Set video mode
je int10_set_vm
cmp ah, 0x01 ; Set cursor shape
je int10_set_cshape
cmp ah, 0x02 ; Set cursor position
je int10_set_cursor
cmp ah, 0x03 ; Get cursur position
je int10_get_cursor
cmp ah, 0x06 ; Scroll up window
je int10_scrollup
cmp ah, 0x07 ; Scroll down window
je int10_scrolldown
cmp ah, 0x08 ; Get character at cursor
je int10_charatcur
cmp ah, 0x09 ; Write char and attribute
je int10_write_char_attrib
cmp ah, 0x0e ; Write character at cursor position
je int10_write_char
cmp ah, 0x0f ; Get video mode
je int10_get_vm
;cmp ah, 0x12 ; Feature check (EGA)
;je int10_ega_features
;cmp ah, 0x1a ; Feature check
;je int10_features
iret
int10_set_vm:
push dx
push cx
push bx
cmp al, 7 ; If an app tries to set Hercules text mode 7, actually set mode 3 (we do not support mode 7's video memory buffer at B000:0)
je int10_set_vm_3
cmp al, 2 ; Same for text mode 2 (mono)
je int10_set_vm_3
jmp int10_set_vm_continue
int10_set_vm_3:
mov al, 3
int10_set_vm_continue:
mov [cs:vidmode], al
mov bh, 7 ; Black background, white foreground
call clear_screen ; ANSI clear screen
cmp byte [cs:vidmode], 6
je set6
mov al, 0x30
jmp svmn
set6:
mov al, 0x3f
svmn:
; Take Hercules adapter out of graphics mode when resetting video mode via int 10
push ax
mov dx, 0x3B8
mov al, 0
out dx, al
pop ax
pop bx
pop cx
pop dx
iret
int10_set_cshape:
push ds
push ax
push cx
mov ax, 0x40
mov ds, ax
mov byte [cursor_visible-bios_data], 1 ; Show cursor
and ch, 01100000b
cmp ch, 00100000b
jne cur_visible
mov byte [cursor_visible-bios_data], 0 ; Hide cursor
cur_visible:
mov al, 0x1B
extended_putchar_al
mov al, '['
extended_putchar_al
mov al, '?'
extended_putchar_al
mov al, '2'
extended_putchar_al
mov al, '5'
extended_putchar_al
mov al, 'l'
sub al, [cursor_visible-bios_data]
sub al, [cursor_visible-bios_data]
sub al, [cursor_visible-bios_data]
sub al, [cursor_visible-bios_data]
extended_putchar_al
pop cx
pop ax
pop ds
iret
int10_set_cursor:
push es
push ax
mov ax, 0x40
mov es, ax
cmp dh, 24
jb skip_set_cur_row_max
mov dh, 24
skip_set_cur_row_max:
cmp dl, 79
jb skip_set_cur_col_max
mov dl, 79
skip_set_cur_col_max:
mov al, 0x1B ; ANSI
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, dh ; Row number
mov [es:curpos_y-bios_data], al
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dl ; Column number
mov [es:curpos_x-bios_data], al
inc al
call puts_decimal_al
mov al, 'H' ; Set cursor position command
extended_putchar_al
pop ax
pop es
iret
int10_get_cursor: ; We don't really support this - just a placeholder
push es
push ax
mov ax, 0x40
mov es, ax
mov cx, 0x0607
mov dl, [es:curpos_x-bios_data]
mov dh, [es:curpos_y-bios_data]
pop ax
pop es
iret
int10_scrollup:
push bx
push cx
push bp
push ax
mov bp, bx ; Convert from CGA to ANSI
mov cl, 12
ror bp, cl
and bp, 7
mov bl, byte [cs:bp+colour_table]
add bl, 10
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bp
pop cx
pop bx
cmp al, 0 ; Clear window
jne cls_partial
cmp cx, 0 ; Start of screen
jne cls_partial
cmp dl, 0x4f ; Clearing columns 0-79
jne cls_partial
cmp dl, 0x18 ; Clearing rows 0-24 (or more)
jl cls_partial
call clear_screen
iret
cls_partial:
push ax
push bx
; mov bx, 0
mov bl, al ; Number of rows to scroll are now in bl
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
cmp ch, 0 ; Start row 1? Maybe full screen
je cls_maybe_fs
jmp cls_not_fs
cls_maybe_fs:
cmp dh, 24 ; End row 25? Full screen for sure
je cls_fs
cls_not_fs:
mov al, ch ; Start row
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dh ; End row
inc al
call puts_decimal_al
cls_fs:
mov al, 'r' ; Set scrolling window
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
cmp bl, 1
jne cls_fs_multiline
mov al, 'M'
jmp cs_fs_ml_out
cls_fs_multiline:
mov al, bl ; Number of rows
call puts_decimal_al
mov al, 'S' ; Scroll up
cs_fs_ml_out:
extended_putchar_al
pop ax
pop bx
; Update "actual" cursor position with expected value - different ANSI terminals do different things
; to the cursor position when you scroll
push ax
push bx
push dx
push es
mov ax, 0x40
mov es, ax
mov ah, 2
mov bh, 0
mov dh, [es:curpos_y-bios_data]
mov dl, [es:curpos_x-bios_data]
int 10h
pop es
pop dx
pop bx
pop ax
;push es
;mov ax, 0x40
;mov es, ax
;sub byte [es:curpos_y-bios_data], bl
;cmp byte [es:curpos_y-bios_data], 0
;jnl int10_scroll_up_vmem_update
;mov byte [es:curpos_y-bios_data], 0
int10_scroll_up_vmem_update:
;pop es
; Now, we need to update video memory
push bx
push ax
push ds
push es
push cx
push dx
push si
push di
push bx
mov bx, 0xb800
mov es, bx
mov ds, bx
pop bx
cls_vmem_scroll_up_next_line:
cmp bl, 0
je cls_vmem_scroll_up_done
cls_vmem_scroll_up_one:
push bx
push dx
mov ax, 0
mov al, ch ; Start row number is now in AX
mov bx, 80
mul bx
add al, cl
adc ah, 0 ; Character number is now in AX
mov bx, 2
mul bx ; Memory location is now in AX
pop dx
pop bx
mov di, ax
mov si, ax
add si, 2*80 ; In a moment we will copy CX words from DS:SI to ES:DI
mov ax, 0
add al, dl
adc ah, 0
inc ax
sub al, cl
sbb ah, 0 ; AX now contains the number of characters from the row to copy
cmp ch, dh
jae cls_vmem_scroll_up_one_done
;jne vmem_scroll_up_copy_next_row
;push cx
;mov cx, ax
;mov ah, 0x47
;mov al, 0
;cld
;rep stosw
;pop cx
;jmp cls_vmem_scroll_up_one_done
vmem_scroll_up_copy_next_row:
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
cld
rep movsw ; Scroll the line up
pop cx
inc ch ; Move onto the next row
jmp cls_vmem_scroll_up_one
cls_vmem_scroll_up_one_done:
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
mov ah, bh ; Attribute for new line
mov al, 0 ; Write 0 to video memory for new characters
cld
rep stosw
pop cx
dec bl ; Scroll whole text block another line
jmp cls_vmem_scroll_up_next_line
cls_vmem_scroll_up_done:
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
pop di
pop si
pop dx
pop cx
pop es
pop ds
pop ax
pop bx
; pop bx
; pop ax
iret
int10_scrolldown:
push bx
push cx
push bp
push ax
mov bp, bx ; Convert from CGA to ANSI
mov cl, 12
ror bp, cl
and bp, 7
mov bl, byte [cs:bp+colour_table]
add bl, 10
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bp
pop cx
pop bx
cmp al, 0 ; Clear window
jne cls_partial_down
cmp cx, 0 ; Start of screen
jne cls_partial_down
cmp dl, 0x4f ; Clearing columns 0-79
jne cls_partial_down
cmp dl, 0x18 ; Clearing rows 0-24 (or more)
jl cls_partial_down
call clear_screen
iret
cls_partial_down:
push ax
push bx
mov bx, 0
mov bl, al ; Number of rows to scroll are now in bl
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
cmp ch, 0 ; Start row 1? Maybe full screen
je cls_maybe_fs_down
jmp cls_not_fs_down
cls_maybe_fs_down:
cmp dh, 24 ; End row 25? Full screen for sure
je cls_fs_down
cls_not_fs_down:
mov al, ch ; Start row
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dh ; End row
inc al
call puts_decimal_al
cls_fs_down:
mov al, 'r' ; Set scrolling window
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Number of rows
call puts_decimal_al
mov al, 'T' ; Scroll down
extended_putchar_al
; Update "actual" cursor position with expected value - different ANSI terminals do different things
; to the cursor position when you scroll
push ax
push bx
push dx
push es
mov ax, 0x40
mov es, ax
mov ah, 2
mov bh, 0
mov dh, [es:curpos_y-bios_data]
mov dl, [es:curpos_x-bios_data]
int 10h
pop es
pop dx
pop bx
pop ax
;push es
;mov ax, 0x40
;mov es, ax
;add byte [es:curpos_y-bios_data], bl
;cmp byte [es:curpos_y-bios_data], 25
;jna int10_scroll_down_vmem_update
;mov byte [es:curpos_y-bios_data], 25
int10_scroll_down_vmem_update:
;pop es
; Now, we need to update video memory
push ds
push es
push cx
push dx
push si
push di
push bx
mov bx, 0xb800
mov es, bx
mov ds, bx
pop bx
cls_vmem_scroll_down_next_line:
cmp bl, 0
je cls_vmem_scroll_down_done
cls_vmem_scroll_down_one:
push bx
push dx
mov ax, 0
mov al, dh ; End row number is now in AX
mov bx, 80
mul bx
add al, cl
adc ah, 0 ; Character number is now in AX
mov bx, 2
mul bx ; Memory location (start of final row) is now in AX
pop dx
pop bx
mov di, ax
mov si, ax
sub si, 2*80 ; In a moment we will copy CX words from DS:SI to ES:DI
mov ax, 0
add al, dl
adc ah, 0
inc ax
sub al, cl
sbb ah, 0 ; AX now contains the number of characters from the row to copy
cmp ch, dh
jae cls_vmem_scroll_down_one_done
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
rep movsw ; Scroll the line down
pop cx
dec dh ; Move onto the next row
jmp cls_vmem_scroll_down_one
cls_vmem_scroll_down_one_done:
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
mov ah, bh ; Attribute for new line
mov al, 0 ; Write 0 to video memory for new characters
rep stosw
pop cx
dec bl ; Scroll whole text block another line
jmp cls_vmem_scroll_down_next_line
cls_vmem_scroll_down_done:
pop di
pop si
pop dx
pop cx
pop es
pop ds
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
pop bx
pop ax
iret
int10_charatcur:
; This returns the character at the cursor. It is completely dysfunctional,
; and only works at all if the character has previously been written following
; an int 10/ah = 2 call to set the cursor position. Added just to support
; GWBASIC.
push ds
push es
push bx
mov bx, 0x40
mov es, bx
mov bx, 0xb000
mov ds, bx
mov bx, 0
add bl, [es:curpos_x-bios_data]
add bl, [es:curpos_x-bios_data]
mov ah, 0
mov al, [bx]
pop bx
pop es
pop ds
iret
i10_unsup:
iret
int10_write_char:
; First we kind of write the character to "video memory". This is so that
; we can later retrieve it using the get character at cursor function,
; which GWBASIC uses.
push ds
push es
push bx
mov bx, 0x40
mov es, bx
mov bx, 0xb000
mov ds, bx
mov bx, 0
mov bl, [es:curpos_x-bios_data]
shl bx, 1
mov [bx], al
cmp al, 0x08
jne int10_write_char_inc_x
dec byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 0
jg int10_write_char_done
mov byte [es:curpos_x-bios_data], 0
jmp int10_write_char_done
int10_write_char_inc_x:
cmp al, 0x0A ; New line?
je int10_write_char_newline
cmp al, 0x0D ; Carriage return?
jne int10_write_char_not_cr
mov byte [es:curpos_x-bios_data],0
jmp int10_write_char_done
int10_write_char_not_cr:
inc byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 80
jge int10_write_char_newline
jmp int10_write_char_done
int10_write_char_newline:
mov byte [es:curpos_x-bios_data], 0
inc byte [es:curpos_y-bios_data]
cmp byte [es:curpos_y-bios_data], 25
jb int10_write_char_done
mov byte [es:curpos_y-bios_data], 24
push cx
push dx
mov bx, 0x0701
mov cx, 0
mov dx, 0x184f
pushf
push cs
call int10_scroll_up_vmem_update
pop dx
pop cx
int10_write_char_done:
pop bx
pop es
pop ds
extended_putchar_al
iret
int10_write_char_attrib:
; First we write the character to a fake "video memory" location. This is so that
; we can later retrieve it using the get character at cursor function, which
; GWBASIC uses in this way to see what has been typed.
push ds
push es
push cx
push bp
push bx
push bx
mov bx, 0x40
mov es, bx
mov bx, 0xb000
mov ds, bx
mov bx, 0
mov bl, [es:curpos_x-bios_data]
shl bx, 1
mov [bx], al
pop bx
push bx
push ax
mov bh, bl
and bl, 7 ; Foreground colour now in bl
mov bp, bx ; Convert from CGA to ANSI
and bp, 0xff
mov bl, byte [cs:bp+colour_table]
and bh, 8 ; Bright attribute now in bh
cpu 186
shr bh, 3
cpu 8086
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bh ; Bright attribute
call puts_decimal_al
mov al, ';'
extended_putchar_al
mov al, bl ; Foreground colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bx
push bx
push ax
mov bh, bl
shr bl, 1
shr bl, 1
shr bl, 1
shr bl, 1
and bl, 7 ; Background colour now in bl
mov bp, bx ; Convert from CGA to ANSI
and bp, 0xff
mov bl, byte [cs:bp+colour_table]
add bl, 10
rol bh, 1
and bh, 1 ; Bright attribute now in bh (not used right now)
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bx
push ax
out_another_char:
extended_putchar_al
dec cx
cmp cx, 0
jne out_another_char
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
cmp al, 0x08
jne int10_write_char_attrib_inc_x
dec byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 0
jg int10_write_char_attrib_done
mov byte [es:curpos_x-bios_data], 0
jmp int10_write_char_attrib_done
int10_write_char_attrib_inc_x:
cmp al, 0x0A ; New line?
je int10_write_char_attrib_newline
cmp al, 0x0D ; Carriage return?
jne int10_write_char_attrib_not_cr
mov byte [es:curpos_x-bios_data],0
jmp int10_write_char_attrib_done
int10_write_char_attrib_not_cr:
inc byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 80
jge int10_write_char_attrib_newline
jmp int10_write_char_attrib_done
int10_write_char_attrib_newline:
mov byte [es:curpos_x-bios_data], 0
inc byte [es:curpos_y-bios_data]
cmp byte [es:curpos_y-bios_data], 25
jb int10_write_char_attrib_done
mov byte [es:curpos_y-bios_data], 24
push cx
push dx
mov bl, 1
mov cx, 0
mov dx, 0x184f
pushf
push cs
call int10_scroll_up_vmem_update
pop dx
pop cx
int10_write_char_attrib_done:
pop ax
pop bx
pop bp
pop cx
pop es
pop ds
iret
int10_get_vm:
mov ah, 80 ; Number of columns
mov al, [cs:vidmode]
mov bh, 0
iret
;int10_ega_features:
; cmp bl, 0x10
; jne i10_unsup
;
; mov bx, 0
; mov cx, 0x0005
; iret
;
; int10_features:
;
; ; Signify we have CGA display
;
; mov al, 0x1a
; mov bx, 0x0202
; iret
; ************************* INT 11h - get equipment list
int11:
mov ax, [cs:equip]
iret
; ************************* INT 12h - return memory size
int12:
mov ax, 0x280 ; 640K conventional memory
iret
; ************************* INT 13h handler - disk services
int13:
cmp ah, 0x00 ; Reset disk
je int13_reset_disk
cmp ah, 0x01 ; Get last status
je int13_last_status
cmp dl, 0x80 ; Hard disk being queried?
jne i13_diskok
; Now, need to check an HD is installed
cmp word [cs:num_disks], 2
jge i13_diskok
; No HD, so return an error
mov ah, 15 ; Report no such drive
jmp reach_stack_stc
i13_diskok:
cmp ah, 0x02 ; Read disk
je int13_read_disk
cmp ah, 0x03 ; Write disk
je int13_write_disk
cmp ah, 0x04 ; Verify disk
je int13_verify
cmp ah, 0x05 ; Format track - does nothing here
je int13_format
cmp ah, 0x08 ; Get drive parameters (hard disk)
je int13_getparams
cmp ah, 0x10 ; Check if drive ready (hard disk)
je int13_hdready
cmp ah, 0x15 ; Get disk type
je int13_getdisktype
cmp ah, 0x16 ; Detect disk change
je int13_diskchange
mov ah, 1 ; Invalid function
jmp reach_stack_stc
iret
int13_reset_disk:
jmp reach_stack_clc
int13_last_status:
mov ah, [cs:disk_laststatus]
je ls_no_error
stc
iret
ls_no_error:
clc
iret
int13_read_disk:
push dx
cmp dl, 0 ; Floppy 0
je i_flop_rd
cmp dl, 0x80 ; HD
je i_hd_rd
pop dx
mov ah, 1
jmp reach_stack_stc
i_flop_rd:
mov dl, 1 ; Floppy disk file handle is stored at j[1] in emulator
jmp i_rd
i_hd_rd:
mov dl, 0 ; Hard disk file handle is stored at j[0] in emulator
i_rd:
push si
push bp
; Convert head/cylinder/sector number to byte offset in disk image
call chs_to_abs
; Now, SI:BP contains the absolute sector offset of the block. We then multiply by 512 to get the offset into the disk image
mov ah, 0
cpu 186
shl ax, 9
extended_read_disk
shr ax, 9
cpu 8086
mov ah, 0x02 ; Put read code back
cmp al, 0
je rd_error
; Read was successful. Now, check if we have read the boot sector. If so, we want to update
; our internal table of sectors/track to match the disk format
cmp dx, 1 ; FDD?
jne rd_noerror
cmp cx, 1 ; First sector?
jne rd_noerror
push ax
mov al, [es:bx+24] ; Number of SPT in floppy disk BPB
cmp al, 0 ; If disk is unformatted, do not update the table
jne rd_update_spt
pop ax
jmp rd_noerror
rd_update_spt:
mov [cs:int1e_spt], al
pop ax
rd_noerror:
clc
mov ah, 0 ; No error
jmp rd_finish
rd_error:
stc
mov ah, 4 ; Sector not found
rd_finish:
pop bp
pop si
pop dx
mov [cs:disk_laststatus], ah
jmp reach_stack_carry
int13_write_disk:
push dx
cmp dl, 0 ; Floppy 0
je i_flop_wr
cmp dl, 0x80 ; HD
je i_hd_wr
pop dx
mov ah, 1
jmp reach_stack_stc
i_flop_wr:
mov dl, 1 ; Floppy disk file handle is stored at j[1] in emulator
jmp i_wr
i_hd_wr:
mov dl, 0 ; Hard disk file handle is stored at j[0] in emulator
i_wr:
push si
push bp
push cx
push di
; Convert head/cylinder/sector number to byte offset in disk image
call chs_to_abs
; Signal an error if we are trying to write beyond the end of the disk
cmp dl, 0 ; Hard disk?
jne wr_fine ; No - no need for disk sector valid check - NOTE: original submission was JNAE which caused write problems on floppy disk
; First, we add the number of sectors we are trying to write from the absolute
; sector number returned by chs_to_abs. We need to have at least this many
; sectors on the disk, otherwise return a sector not found error.
mov cx, bp
mov di, si
mov ah, 0
add cx, ax
adc di, 0
cmp di, [cs:hd_secs_hi]
ja wr_error
jb wr_fine
cmp cx, [cs:hd_secs_lo]
ja wr_error
wr_fine:
mov ah, 0
cpu 186
shl ax, 9
extended_write_disk
shr ax, 9
cpu 8086
mov ah, 0x03 ; Put write code back
cmp al, 0
je wr_error
clc
mov ah, 0 ; No error
jmp wr_finish
wr_error:
stc
mov ah, 4 ; Sector not found
wr_finish:
pop di
pop cx
pop bp
pop si
pop dx
mov [cs:disk_laststatus], ah
jmp reach_stack_carry
int13_verify:
mov ah, 0
jmp reach_stack_clc
int13_getparams:
cmp dl, 0
je i_gp_fl
cmp dl, 0x80
je i_gp_hd
mov ah, 0x01
mov [cs:disk_laststatus], ah
jmp reach_stack_stc
i_gp_fl:
mov ax, 0
mov bx, 4
mov cx, 0x4f12
mov dx, 0x0101
mov byte [cs:disk_laststatus], 0
jmp reach_stack_clc
i_gp_hd:
mov ax, 0
mov bx, 0
mov dl, 1
mov dh, [cs:hd_max_head]
mov cx, [cs:hd_max_track]
ror ch, 1
ror ch, 1
add ch, [cs:hd_max_sector]
xchg ch, cl
mov byte [cs:disk_laststatus], 0
jmp reach_stack_clc
int13_hdready:
cmp byte [cs:num_disks], 2 ; HD present?
jne int13_hdready_nohd
cmp dl, 0x80 ; Checking first HD?
jne int13_hdready_nohd
mov ah, 0
jmp reach_stack_clc
int13_hdready_nohd:
jmp reach_stack_stc
int13_format:
mov ah, 0
jmp reach_stack_clc
int13_getdisktype:
cmp dl, 0 ; Floppy
je gdt_flop
cmp dl, 0x80 ; HD
je gdt_hd
mov ah, 15 ; Report no such drive
mov [cs:disk_laststatus], ah
jmp reach_stack_stc
gdt_flop:
mov ah, 1
jmp reach_stack_clc
gdt_hd:
mov ah, 3
mov cx, [cs:hd_secs_hi]
mov dx, [cs:hd_secs_lo]
jmp reach_stack_clc
int13_diskchange:
mov ah, 0 ; Disk not changed
jmp reach_stack_clc
; ************************* INT 14h - serial port functions
int14:
cmp ah, 0
je int14_init
iret
int14_init:
mov ax, 0
iret
; ************************* INT 15h - get system configuration
int15: ; Here we do not support any of the functions, and just return
; a function not supported code - like the original IBM PC/XT does.
; cmp ah, 0xc0
; je int15_sysconfig
; cmp ah, 0x41
; je int15_waitevent
; cmp ah, 0x4f
; je int15_intercept
; cmp ah, 0x88
; je int15_getextmem
; Otherwise, function not supported
mov ah, 0x86
jmp reach_stack_stc
; int15_sysconfig: ; Return address of system configuration table in ROM
;
; mov bx, 0xf000
; mov es, bx
; mov bx, rom_config
; mov ah, 0
;
; jmp reach_stack_clc
;
; int15_waitevent: ; Events not supported
;
; mov ah, 0x86
;
; jmp reach_stack_stc
;
; int15_intercept: ; Keyboard intercept
;
; jmp reach_stack_stc
;
; int15_getextmem: ; Extended memory not supported
;
; mov ah,0x86
;
; jmp reach_stack_stc
; ************************* INT 16h handler - keyboard
int16:
cmp ah, 0x00 ; Get keystroke (remove from buffer)
je kb_getkey
cmp ah, 0x01 ; Check for keystroke (do not remove from buffer)
je kb_checkkey
cmp ah, 0x02 ; Check shift flags
je kb_shiftflags
cmp ah, 0x12 ; Check shift flags
je kb_extshiftflags
iret
kb_getkey:
push es
push bx
push cx
push dx
sti
mov bx, 0x40
mov es, bx
kb_gkblock:
mov cx, [es:kbbuf_tail-bios_data]
mov bx, [es:kbbuf_head-bios_data]
mov dx, [es:bx]
; Wait until there is a key in the buffer
cmp cx, bx
je kb_gkblock
add word [es:kbbuf_head-bios_data], 2
call kb_adjust_buf
mov ah, dh
mov al, dl
pop dx
pop cx
pop bx
pop es
iret
kb_checkkey:
push es
push bx
push cx
push dx
sti
mov bx, 0x40
mov es, bx
mov cx, [es:kbbuf_tail-bios_data]
mov bx, [es:kbbuf_head-bios_data]
mov dx, [es:bx]
; Check if there is a key in the buffer. ZF is set if there is none.
cmp cx, bx
mov ah, dh
mov al, dl
pop dx
pop cx
pop bx
pop es
retf 2 ; NEED TO FIX THIS!!
kb_shiftflags:
push es
push bx
mov bx, 0x40
mov es, bx
mov al, [es:keyflags1-bios_data]
pop bx
pop es
iret
kb_extshiftflags:
push es
push bx
mov bx, 0x40
mov es, bx
mov al, [es:keyflags1-bios_data]
mov ah, al
pop bx
pop es
iret
; ************************* INT 17h handler - printer
int17:
cmp ah, 0x01
je int17_initprint ; Initialise printer
iret
int17_initprint:
mov ah, 0
iret
; ************************* INT 19h = reboot
int19:
jmp boot
; ************************* INT 1Ah - clock
int1a:
cmp ah, 0
je int1a_getsystime ; Get ticks since midnight (used for RTC time)
cmp ah, 2
je int1a_gettime ; Get RTC time (not actually used by DOS)
cmp ah, 4
je int1a_getdate ; Get RTC date
cmp ah, 0x0f
je int1a_init ; Initialise RTC
iret
int1a_getsystime:
push ax
push bx
push ds
push es
push cs
push cs
pop ds
pop es
mov bx, timetable
extended_get_rtc
mov ax, 182 ; Clock ticks in 10 seconds
mul word [tm_sec]
mov bx, 10
mov dx, 0
div bx ; AX now contains clock ticks in seconds counter
mov [tm_sec], ax
mov ax, 1092 ; Clock ticks in a minute
mul word [tm_min] ; AX now contains clock ticks in minutes counter
mov [tm_min], ax
mov ax, 65520 ; Clock ticks in an hour
mul word [tm_hour] ; DX:AX now contains clock ticks in hours counter
add ax, [tm_sec] ; Add seconds in to AX
adc dx, 0 ; Carry into DX if necessary
add ax, [tm_min] ; Add minutes in to AX
adc dx, 0 ; Carry into DX if necessary
push dx
push ax
pop dx
pop cx
pop es
pop ds
pop bx
pop ax
mov al, 0
iret
int1a_gettime:
; Return the system time in BCD format. DOS doesn't use this, but we need to return
; something or the system thinks there is no RTC.
push ds
push es
push ax
push bx
push cs
push cs
pop ds
pop es
mov bx, timetable
extended_get_rtc
mov ax, 0
mov cx, [tm_hour]
call hex_to_bcd
mov bh, al ; Hour in BCD is in BH
mov ax, 0
mov cx, [tm_min]
call hex_to_bcd
mov bl, al ; Minute in BCD is in BL
mov ax, 0
mov cx, [tm_sec]
call hex_to_bcd
mov dh, al ; Second in BCD is in DH
mov dl, 0 ; Daylight saving flag = 0 always
mov cx, bx ; Hour:minute now in CH:CL
pop bx
pop ax
pop es
pop ds
jmp reach_stack_clc
int1a_getdate:
; Return the system date in BCD format.
push ds
push es
push bx
push ax
push cs
push cs
pop ds
pop es
mov bx, timetable
extended_get_rtc
mov ax, 0x1900
mov cx, [tm_year]
call hex_to_bcd
mov cx, ax
push cx
mov ax, 1
mov cx, [tm_mon]
call hex_to_bcd
mov dh, al
mov ax, 0
mov cx, [tm_mday]
call hex_to_bcd
mov dl, al
pop cx
pop ax
pop bx
pop es
pop ds
jmp reach_stack_clc
int1a_init:
jmp reach_stack_clc
; ************************* INT 1Ch - the other timer interrupt
int1c:
iret
; ************************* INT 1Eh - diskette parameter table
int1e:
db 0xdf ; Step rate 2ms, head unload time 240ms
db 0x02 ; Head load time 4 ms, non-DMA mode 0
db 0x25 ; Byte delay until motor turned off
db 0x02 ; 512 bytes per sector
int1e_spt db 0xff ; 18 sectors per track (1.44MB)
db 0x1B ; Gap between sectors for 3.5" floppy
db 0xFF ; Data length (ignored)
db 0x54 ; Gap length when formatting
db 0xF6 ; Format filler byte
db 0x0F ; Head settle time (1 ms)
db 0x08 ; Motor start time in 1/8 seconds
; ************************* INT 41h - hard disk parameter table
int41:
int41_max_cyls dw 0
int41_max_heads db 0
dw 0
dw 0
db 0
db 11000000b
db 0
db 0
db 0
dw 0
int41_max_sect db 0
db 0
; ************************* ROM configuration table
rom_config dw 16 ; 16 bytes following
db 0xfe ; Model
db 'A' ; Submodel
db 'C' ; BIOS revision
db 0b00100000 ; Feature 1
db 0b00000000 ; Feature 2
db 0b00000000 ; Feature 3
db 0b00000000 ; Feature 4
db 0b00000000 ; Feature 5
db 0, 0, 0, 0, 0, 0
; Internal state variables
num_disks dw 0 ; Number of disks present
hd_secs_hi dw 0 ; Total sectors on HD (high word)
hd_secs_lo dw 0 ; Total sectors on HD (low word)
hd_max_sector dw 0 ; Max sector number on HD
hd_max_track dw 0 ; Max track number on HD
hd_max_head dw 0 ; Max head number on HD
drive_tracks_temp dw 0
drive_sectors_temp dw 0
drive_heads_temp dw 0
drive_num_temp dw 0
boot_state db 0
cga_refresh_reg db 0
; Default interrupt handlers
int0:
int1:
int2:
int3:
int4:
int5:
int6:
int9:
inta:
intb:
intc:
intd:
inte:
intf:
int18:
int1b:
int1d:
iret
; ************ Function call library ************
; Hex to BCD routine. Input is AX in hex (can be 0), and adds CX in hex to it, forming a BCD output in AX.
hex_to_bcd:
push bx
jcxz h2bfin
h2bloop:
inc ax
; First process the low nibble of AL
mov bh, al
and bh, 0x0f
cmp bh, 0x0a
jne c1
add ax, 0x0006
; Then the high nibble of AL
c1:
mov bh, al
and bh, 0xf0
cmp bh, 0xa0
jne c2
add ax, 0x0060
; Then the low nibble of AH
c2:
mov bh, ah
and bh, 0x0f
cmp bh, 0x0a
jne c3
add ax, 0x0600
c3:
loop h2bloop
h2bfin:
pop bx
ret
; Takes a number in AL (from 0 to 99), and outputs the value in decimal using extended_putchar_al.
puts_decimal_al:
push ax
aam
add ax, 0x3030 ; '00'
xchg ah, al ; First digit is now in AL
cmp al, 0x30
je pda_2nd ; First digit is zero, so print only 2nd digit
extended_putchar_al ; Print first digit
pda_2nd:
xchg ah, al ; Second digit is now in AL
extended_putchar_al ; Print second digit
pop ax
ret
; Keyboard adjust buffer head and tail. If either head or the tail are at the end of the buffer, reset them
; back to the start, since it is a circular buffer.
kb_adjust_buf:
push ax
push bx
; Check to see if the head is at the end of the buffer (or beyond). If so, bring it back
; to the start
mov ax, [es:kbbuf_end_ptr-bios_data]
cmp [es:kbbuf_head-bios_data], ax
jnge kb_adjust_tail
mov bx, [es:kbbuf_start_ptr-bios_data]
mov [es:kbbuf_head-bios_data], bx
kb_adjust_tail:
; Check to see if the tail is at the end of the buffer (or beyond). If so, bring it back
; to the start
mov ax, [es:kbbuf_end_ptr-bios_data]
cmp [es:kbbuf_tail-bios_data], ax
jnge kb_adjust_done
mov bx, [es:kbbuf_start_ptr-bios_data]
mov [es:kbbuf_tail-bios_data], bx
kb_adjust_done:
pop bx
pop ax
ret
; Convert CHS disk position (in CH, CL and DH) to absolute sector number in BP:SI
; Floppy disks have 512 bytes per sector, 9/18 sectors per track, 2 heads. DH is head number (1 or 0), CH bits 5..0 is
; sector number, CL7..6 + CH7..0 is 10-bit cylinder/track number. Hard disks have 512 bytes per sector, but a variable
; number of tracks and heads.
chs_to_abs:
push ax
push bx
push cx
push dx
mov [cs:drive_num_temp], dl
; First, we extract the track number from CH and CL.
push cx
mov bh, cl
mov cl, 6
shr bh, cl
mov bl, ch
; Multiply track number (now in BX) by the number of heads
cmp byte [cs:drive_num_temp], 1 ; Floppy disk?
push dx
mov dx, 0
xchg ax, bx
jne chs_hd
shl ax, 1 ; Multiply by 2 (number of heads on FD)
push ax
xor ax, ax
mov al, [cs:int1e_spt]
mov [cs:drive_sectors_temp], ax ; Retrieve sectors per track from INT 1E table
pop ax
jmp chs_continue
chs_hd:
mov bp, [cs:hd_max_head]
inc bp
mov [cs:drive_heads_temp], bp
mul word [cs:drive_heads_temp] ; HD, so multiply by computed head count
mov bp, [cs:hd_max_sector] ; We previously calculated maximum HD track, so number of tracks is 1 more
mov [cs:drive_sectors_temp], bp
chs_continue:
xchg ax, bx
pop dx
xchg dh, dl
mov dh, 0
add bx, dx
mov ax, [cs:drive_sectors_temp]
mul bx
; Now we extract the sector number (from 1 to 63) - for some reason they start from 1
pop cx
mov ch, 0
and cl, 0x3F
dec cl
add ax, cx
adc dx, 0
mov bp, ax
mov si, dx
; Now, SI:BP contains offset into disk image file (FD or HD)
pop dx
pop cx
pop bx
pop ax
ret
; Clear screen using ANSI codes. Also clear video memory with attribute in BH
clear_screen:
push ax
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, 'r' ; Set scrolling window
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm' ; Reset attributes
extended_putchar_al
push bx
push cx
push bp
push ax
push es
mov bp, bx ; Convert from CGA to ANSI
mov cl, 12
ror bp, cl
and bp, 7
mov bl, byte [cs:bp+colour_table]
add bl, 10
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
mov ax, 0x40
mov es, ax
mov byte [es:curpos_x-bios_data], 0
mov byte [es:curpos_y-bios_data], 0
pop es
pop ax
pop bp
pop cx
pop bx
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '2' ; Clear screen
extended_putchar_al
mov al, 'J'
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '1' ; Cursor row 1
extended_putchar_al
mov al, ';'
extended_putchar_al
mov al, '1' ; Cursor column 1
extended_putchar_al
mov al, 'H' ; Set cursor
extended_putchar_al
push es
push di
push cx
cld
mov ax, 0xb800
mov es, ax
mov di, 0
mov al, 0
mov ah, bh
mov cx, 80*25
rep stosw
pop cx
pop di
pop es
pop ax
ret
; Pushes a key press, followed by a key release, event to I/O port 0x60 and calls
; INT 9.
keypress_release:
push ax
cmp byte [es:key_now_down-bios_data], 0
je kpr_no_key_down
mov al, [es:key_now_down-bios_data]
add al, 0x80
out 0x60, al
int 9
pop ax
push ax
kpr_no_key_down:
mov [es:key_now_down-bios_data], al
out 0x60, al
int 9
pop ax
ret
; Reaches up into the stack before the end of an interrupt handler, and sets the carry flag
reach_stack_stc:
xchg bp, sp
or word [bp+4], 1
xchg bp, sp
iret
; Reaches up into the stack before the end of an interrupt handler, and clears the carry flag
reach_stack_clc:
xchg bp, sp
and word [bp+4], 0xfffe
xchg bp, sp
iret
; Reaches up into the stack before the end of an interrupt handler, and returns with the current
; setting of the carry flag
reach_stack_carry:
jc reach_stack_stc
jmp reach_stack_clc
; This is the VMEM driver, to support direct video memory access in 80x25 colour CGA mode.
; It scans through CGA video memory at address B800:0, and if there is anything there (i.e.
; applications are doing direct video memory writes), converts the buffer to a sequence of
; ANSI terminal codes to render the screen output.
;
; Note: this destroys all registers. It is the responsibility of the caller to save/restore
; them.
vmem_driver_entry:
cmp byte [cs:in_update], 1
je just_finish ; If we are already in the middle of an update, just pass INT 8 on. Needed for re-entrancy.
inc byte [cs:int8_ctr]
cmp byte [cs:int8_ctr], 5 ; Only do this once every 5 timer ticks
je gmode_test
just_finish:
ret
gmode_test:
mov dx, 0x3b8 ; Do not update if in Hercules graphics mode
in al, dx
test al, 2
jz vram_zero_check
ret
vram_zero_check: ; Check if video memory is blank - if so, do nothing
mov byte [cs:int8_ctr], 0
mov byte [cs:in_update], 1
sti
cld
mov bx, 0xb800
mov es, bx
mov cx, 0x7d0
mov ax, 0x0700
mov di, 0
repz scasw
cmp cx, 0
jne vram_update ; CX != 0 so something has been written to video RAM
mov byte [cs:in_update], 0
ret
vram_update:
mov bx, 0x40
mov ds, bx
mov byte [cs:int_curpos_x], 0xff
mov byte [cs:int_curpos_y], 0xff
cmp byte [cursor_visible-bios_data], 0
je dont_hide_cursor
mov al, 0x1B
extended_putchar_al
mov al, '['
extended_putchar_al
mov al, '?'
extended_putchar_al
mov al, '2'
extended_putchar_al
mov al, '5'
extended_putchar_al
mov al, 'l'
extended_putchar_al
dont_hide_cursor:
mov byte [cs:last_attrib], 0xff
mov bx, 0xb800
mov ds, bx
; Set up the initial cursor coordinates. Since the first thing we do is increment the cursor
; position, this initial position is actually off the screen
mov bp, -1 ; Row number
mov si, 79 ; Column number
mov di, -2 ; Combined offset
disp_loop:
; Advance to next column
add di, 2
inc si
cmp si, 80
jne cont
; Column is 80, so set to 0 and advance a line
mov si, 0
inc bp
; Bottom of the screen reached already? If so, we're done
cmp bp, 25
je restore_cursor
cont:
cmp byte [di], 0 ; Ignore null characters in video memory
je disp_loop
mov ax, bp
mov bx, si
mov dh, al
mov dl, bl
ansi_set_cur_pos:
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, dh ; Row number
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dl ; Column number
inc al
call puts_decimal_al
mov al, 'H' ; Set cursor position command
extended_putchar_al
skip_set_cur_pos:
mov [cs:int_curpos_y], dh
mov [cs:int_curpos_x], dl
mov bl, [di+1]
cmp bl, [cs:last_attrib]
je skip_attrib
mov [cs:last_attrib], bl
push bx
mov bh, bl
and bl, 7 ; Foreground colour now in bl
push bp
mov bp, bx ; Convert from CGA to ANSI
and bp, 7
mov bl, byte [cs:bp+colour_table]
pop bp
and bh, 8 ; Bright attribute now in bh
cpu 186
shr bh, 3
cpu 8086
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bh ; Bright attribute
call puts_decimal_al
mov al, ';'
extended_putchar_al
mov al, bl ; Foreground colour
call puts_decimal_al
mov al, ';'
extended_putchar_al
pop bx
cpu 186
shr bl, 4
cpu 8086
and bl, 7 ; Background colour now in bl
push bp
mov bp, bx ; Convert from CGA to ANSI
and bp, 7
mov bl, byte [cs:bp+colour_table]
pop bp
add bl, 10
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor attribute command
extended_putchar_al
skip_attrib:
mov al, [di]
cmp al, 7 ; Convert BEL character to 0xFE
jne check_space1
mov al, 0xFE
check_space1:
cmp al, 4 ; Convert DIAMOND character to 0xFE
jne just_show_it
mov al, 0xFE
just_show_it:
extended_putchar_al
jmp disp_loop
restore_cursor:
mov bx, 0x40
mov ds, bx
mov ah, 2
mov bh, 0
mov dh, [curpos_y-bios_data]
mov dl, [curpos_x-bios_data]
int 10h
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
cmp byte [cursor_visible-bios_data], 0
je vmem_done
mov al, 0x1B
extended_putchar_al
mov al, '['
extended_putchar_al
mov al, '?'
extended_putchar_al
mov al, '2'
extended_putchar_al
mov al, '5'
extended_putchar_al
mov al, 'h'
extended_putchar_al
vmem_done:
mov byte [cs:in_update], 0
ret
; ****************************************************************************************
; That's it for the code. Now, the data tables follow.
; ****************************************************************************************
; Standard PC-compatible BIOS data area - to copy to 40:0
bios_data:
com1addr dw 0
com2addr dw 0
com3addr dw 0
com4addr dw 0
lpt1addr dw 0
lpt2addr dw 0
lpt3addr dw 0
lpt4addr dw 0
equip dw 0b0000000100100001
db 0
memsize dw 0x280
db 0
db 0
keyflags1 db 0
keyflags2 db 0
db 0
kbbuf_head dw kbbuf-bios_data
kbbuf_tail dw kbbuf-bios_data
kbbuf: times 32 db 'X'
drivecal db 0
diskmotor db 0
motorshutoff db 0x07
disk_laststatus db 0
times 7 db 0
vidmode db 0x03
vid_cols dw 80
page_size dw 0x1000
dw 0
curpos_x db 0
curpos_y db 0
times 7 dw 0
cur_v_end db 7
cur_v_start db 6
disp_page db 0
crtport dw 0x3d4
db 10
db 0
times 5 db 0
clk_dtimer dd 0
clk_rollover db 0
ctrl_break db 0
soft_rst_flg dw 0x1234
db 0
num_hd db 0
db 0
db 0
dd 0
dd 0
kbbuf_start_ptr dw 0x001e
kbbuf_end_ptr dw 0x003e
vid_rows db 25 ; at 40:84
db 0
db 0
vidmode_opt db 0 ; 0x70
db 0 ; 0x89
db 0 ; 0x51
db 0 ; 0x0c
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
kb_mode db 0
kb_led db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
key_now_down db 0
next_key_fn db 0
cursor_visible db 1
escape_flag_last db 0
next_key_alt db 0
escape_flag db 0
notranslate_flg db 0
this_keystroke db 0
db 0
ending: times (0xff-($-com1addr)) db 0
; Keyboard scan code tables
a2scan_tbl db 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x39, 0x02, 0x28, 0x04, 0x05, 0x06, 0x08, 0x28, 0x0A, 0x0B, 0x09, 0x0D, 0x33, 0x0C, 0x34, 0x35, 0x0B, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x27, 0x27, 0x33, 0x0D, 0x34, 0x35, 0x03, 0x1E, 0x30, 0x2E, 0x20, 0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, 0x32, 0x31, 0x18, 0x19, 0x10, 0x13, 0x1F, 0x14, 0x16, 0x2F, 0x11, 0x2D, 0x15, 0x2C, 0x1A, 0x2B, 0x1B, 0x07, 0x0C, 0x29, 0x1E, 0x30, 0x2E, 0x20, 0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, 0x32, 0x31, 0x18, 0x19, 0x10, 0x13, 0x1F, 0x14, 0x16, 0x2F, 0x11, 0x2D, 0x15, 0x2C, 0x1A, 0x2B, 0x1B, 0x29, 0x0E
a2shift_tbl db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0
; Interrupt vector table - to copy to 0:0
int_table dw int0
dw 0xf000
dw int1
dw 0xf000
dw int2
dw 0xf000
dw int3
dw 0xf000
dw int4
dw 0xf000
dw int5
dw 0xf000
dw int6
dw 0xf000
dw int7
dw 0xf000
dw int8
dw 0xf000
dw int9
dw 0xf000
dw inta
dw 0xf000
dw intb
dw 0xf000
dw intc
dw 0xf000
dw intd
dw 0xf000
dw inte
dw 0xf000
dw intf
dw 0xf000
dw int10
dw 0xf000
dw int11
dw 0xf000
dw int12
dw 0xf000
dw int13
dw 0xf000
dw int14
dw 0xf000
dw int15
dw 0xf000
dw int16
dw 0xf000
dw int17
dw 0xf000
dw int18
dw 0xf000
dw int19
dw 0xf000
dw int1a
dw 0xf000
dw int1b
dw 0xf000
dw int1c
dw 0xf000
dw int1d
dw 0xf000
dw int1e
itbl_size dw $-int_table
; Colour table for converting CGA video memory colours to ANSI colours
colour_table db 30, 34, 32, 36, 31, 35, 33, 37
; Internal variables for VMEM driver
int8_ctr db 0
in_update db 0
last_attrib db 0
int_curpos_x db 0
int_curpos_y db 0
; Int 8 call counter - used for timer slowdown
int8_call_cnt db 0
; Now follow the tables for instruction decode helping
; R/M mode tables
rm_mode0_reg1 db 3, 3, 5, 5, 6, 7, 12, 3
rm_mode0_reg2 db 6, 7, 6, 7, 12, 12, 12, 12
rm_mode0_disp db 0, 0, 0, 0, 0, 0, 1, 0
rm_mode0_dfseg db 11, 11, 10, 10, 11, 11, 11, 11
rm_mode12_reg1 db 3, 3, 5, 5, 6, 7, 5, 3
rm_mode12_reg2 db 6, 7, 6, 7, 12, 12, 12, 12
rm_mode12_disp db 1, 1, 1, 1, 1, 1, 1, 1
rm_mode12_dfseg db 11, 11, 10, 10, 11, 11, 10, 11
; Opcode decode tables
xlat_ids db 0, 1, 2, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 47, 17, 17, 18, 19, 20, 19, 21, 22, 21, 22, 23, 53, 24, 25, 26, 25, 25, 26, 25, 26, 27, 28, 27, 28, 27, 29, 27, 29, 48, 30, 31, 32, 53, 33, 34, 35, 36, 37, 37, 38, 39, 40, 19, 41, 42, 43, 44, 53, 53, 45, 46, 46, 46, 46, 46, 46, 52, 52, 12
i_opcodes db 17, 17, 17, 17, 8, 8, 49, 50, 18, 18, 18, 18, 9, 9, 51, 64, 19, 19, 19, 19, 10, 10, 52, 53, 20, 20, 20, 20, 11, 11, 54, 55, 21, 21, 21, 21, 12, 12, 56, 57, 22, 22, 22, 22, 13, 13, 58, 59, 23, 23, 23, 23, 14, 14, 60, 61, 24, 24, 24, 24, 15, 15, 62, 63, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 31, 31, 48, 48, 25, 25, 25, 25, 26, 26, 26, 26, 32, 32, 32, 32, 32, 32, 32, 32, 65, 66, 67, 68, 69, 70, 71, 72, 27, 27, 27, 27, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 94, 94, 39, 39, 73, 74, 40, 40, 0, 0, 41, 41, 75, 76, 77, 78, 28, 28, 28, 28, 79, 80, 81, 82, 47, 47, 47, 47, 47, 47, 47, 47, 29, 29, 29, 29, 42, 42, 43, 43, 30, 30, 30, 30, 44, 44, 45, 45, 83, 0, 46, 46, 84, 85, 7, 7, 86, 87, 88, 89, 90, 91, 6, 6
ex_data db 21, 0, 0, 1, 0, 0, 0, 21, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 0, 0, 43, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 1, 0, 0, 1, 1, 0, 3, 0, 8, 8, 9, 10, 10, 11, 11, 8, 27, 9, 39, 10, 2, 11, 0, 36, 0, 0, 0, 0, 0, 0, 255, 0, 16, 22, 0, 255, 48, 2, 255, 255, 40, 11, 1, 2, 40, 80, 81, 92, 93, 94, 95, 0, 21, 1
std_szp db 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
std_ao db 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
std_o0c0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
base_size db 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3
i_w_adder db 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
i_mod_adder db 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
flags_mult db 0, 2, 4, 6, 7, 8, 9, 10, 11
jxx_dec_a db 48, 40, 43, 40, 44, 41, 49, 49
jxx_dec_b db 49, 49, 49, 43, 49, 49, 49, 43
jxx_dec_c db 49, 49, 49, 49, 49, 49, 44, 44
jxx_dec_d db 49, 49, 49, 49, 49, 49, 48, 48
daa_rslt_ca00 db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101
daa_cf_ca00_ca01_das_cf_ca00 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
daa_af_ca00_ca10_das_af_ca00_ca10 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
daa_rslt_ca01 db 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101
daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
daa_rslt_ca10 db 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 160, 161, 162, 163, 164, 165, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 192, 193, 194, 195, 196, 197, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101
daa_rslt_ca11 db 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101
das_rslt_ca00 db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 148, 149, 150, 151, 152, 153
das_rslt_ca01 db 154, 155, 156, 157, 158, 159, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
das_cf_ca01 db 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
das_rslt_ca10 db 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 164, 165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 180, 181, 182, 183, 184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 244, 245, 246, 247, 248, 249, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 148, 149, 150, 151, 152, 153
das_rslt_ca11 db 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
parity db 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
; This is the format of the 36-byte tm structure, returned by the emulator's RTC query call
timetable:
tm_sec equ $
tm_min equ $+4
tm_hour equ $+8
tm_mday equ $+12
tm_mon equ $+16
tm_year equ $+20
tm_wday equ $+24
tm_yday equ $+28
tm_dst equ $+32 | 24.148899 | 1,186 | 0.6201 |
aa872f4221cd9c6aee52c985e19e5af775f43d8b | 2,391 | kt | Kotlin | app/src/main/java/com/havriiash/dmitriy/githubbrowser/di/modules/user/UserDetailContainerFragmentModule.kt | Havriiash/GithubBrowser | a197d29e16e3e932665fefdde104560b34763319 | [
"MIT"
] | 1 | 2018-07-25T09:04:53.000Z | 2018-07-25T09:04:53.000Z | app/src/main/java/com/havriiash/dmitriy/githubbrowser/di/modules/user/UserDetailContainerFragmentModule.kt | Havriyash/GithubBrowser | a197d29e16e3e932665fefdde104560b34763319 | [
"MIT"
] | null | null | null | app/src/main/java/com/havriiash/dmitriy/githubbrowser/di/modules/user/UserDetailContainerFragmentModule.kt | Havriyash/GithubBrowser | a197d29e16e3e932665fefdde104560b34763319 | [
"MIT"
] | null | null | null | package com.havriiash.dmitriy.githubbrowser.di.modules.user
import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider
import com.havriiash.dmitriy.githubbrowser.data.remote.entity.User
import com.havriiash.dmitriy.githubbrowser.main.ui.base.FragmentContainerListener
import com.havriiash.dmitriy.githubbrowser.main.ui.fragments.user.UserDetailActivityFragment
import com.havriiash.dmitriy.githubbrowser.main.ui.fragments.user.UserDetailContainerFragment
import com.havriiash.dmitriy.githubbrowser.main.ui.fragments.user.UserDetailInfoFragment
import com.havriiash.dmitriy.githubbrowser.main.ui.fragments.user.UserDetailStarredFragment
import com.havriiash.dmitriy.githubbrowser.main.vm.UserDetailViewModel
import com.havriiash.dmitriy.githubbrowser.main.vm.factory.UserDetailVMFactory
import com.havriiash.dmitriy.spdilib.scopes.ChildFragmentScope
import com.havriiash.dmitriy.spdilib.scopes.FragmentScope
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.android.ContributesAndroidInjector
@Module
abstract class UserDetailContainerFragmentModule {
@FragmentScope
@Binds
abstract fun bindUserDetailViewModel(userDetailViewModel: UserDetailViewModel): ViewModel
@FragmentScope
@Binds
abstract fun bindUserDetailVMFactory(userDetailVMFactory: UserDetailVMFactory): ViewModelProvider.Factory
@Module
companion object {
@FragmentScope
@JvmStatic
@Provides
fun provideUserName(userDetailContainerFragment: UserDetailContainerFragment): String {
return userDetailContainerFragment.arguments?.getString(UserDetailContainerFragment.USER_PARAM, "")!!
}
}
@FragmentScope
@Binds
abstract fun bindContainerListener(userDetailContainerFragment: UserDetailContainerFragment): FragmentContainerListener<User>
@ChildFragmentScope
@ContributesAndroidInjector(modules = [UserDetailFragmentModule::class])
abstract fun userDetailFragment(): UserDetailInfoFragment
@ChildFragmentScope
@ContributesAndroidInjector(modules = [UserDetailStarredFragmentModule::class])
abstract fun userDetailStarredFragment(): UserDetailStarredFragment
@ChildFragmentScope
@ContributesAndroidInjector(modules = [UserDetailActivityFragmentModule::class])
abstract fun userDetailActivityFragment(): UserDetailActivityFragment
} | 41.224138 | 129 | 0.825596 |
2f3b2a682d9f1c131c04d22999a3a614357d2fc3 | 1,251 | cs | C# | src/behavioural/command/003_undoing_and_redoing_execution/Command/TextEditor.cs | danieldeveloper001/csharp_design_patterns | 55c018385db7f2e3052acd2c3c77797dbeedf870 | [
"MIT"
] | 1 | 2020-07-17T15:33:09.000Z | 2020-07-17T15:33:09.000Z | src/behavioural/command/003_undoing_and_redoing_execution/Command/TextEditor.cs | danieldeveloper001/csharp_design_patterns | 55c018385db7f2e3052acd2c3c77797dbeedf870 | [
"MIT"
] | 22 | 2020-05-05T02:16:38.000Z | 2020-08-16T16:21:04.000Z | src/behavioural/command/003_undoing_and_redoing_execution/Command/TextEditor.cs | danieldeveloper001/csharp_design_patterns | 55c018385db7f2e3052acd2c3c77797dbeedf870 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
namespace Project
{
interface ITextEditor
{
Stack<ITextOperation> UndoStack { get; }
Stack<ITextOperation> RedoStack { get; }
void Do(ITextOperation operation);
void Undo();
void Redo();
}
class TextEditor : ITextEditor
{
public Stack<ITextOperation> UndoStack { get; private set; }
public Stack<ITextOperation> RedoStack { get; private set; }
public TextEditor()
{
UndoStack = new Stack<ITextOperation>();
RedoStack = new Stack<ITextOperation>();
}
public void Do(ITextOperation operation)
{
operation.Do();
UndoStack.Push(operation);
RedoStack.Clear();
}
public void Undo()
{
if (UndoStack.Count == 0)
return;
var operation = UndoStack.Pop();
operation.Undo();
RedoStack.Push(operation);
}
public void Redo()
{
if (RedoStack.Count == 0)
return;
var operation = RedoStack.Pop();
operation.Do();
UndoStack.Push(operation);
}
}
}
| 22.339286 | 68 | 0.521982 |
18cf0b273e611d8c2992298053fa76c6d47157f2 | 5,357 | swift | Swift | Exercises/Exercises/ExercisesViewController.swift | amaglovany/Exercises-Test-Task | f14e1ea23bf60ec249304667e963a2927eb13bf6 | [
"MIT"
] | null | null | null | Exercises/Exercises/ExercisesViewController.swift | amaglovany/Exercises-Test-Task | f14e1ea23bf60ec249304667e963a2927eb13bf6 | [
"MIT"
] | null | null | null | Exercises/Exercises/ExercisesViewController.swift | amaglovany/Exercises-Test-Task | f14e1ea23bf60ec249304667e963a2927eb13bf6 | [
"MIT"
] | null | null | null | //
// ExercisesViewController.swift
// Exercises
//
// Created by amaglovany on 8/28/19.
// Copyright © 2019 amaglovany. All rights reserved.
//
import UIKit
class ExercisesViewController: UITableViewController {
var exercises = [Exercise]()
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(AddSetsCell.self)
tableView.register(SetCell.self)
}
// MARK: - Actions
@IBAction func addDidPressed(_ sender: UIBarButtonItem) {
exercises.append(Exercise())
tableView.reloadData()
}
}
// MARK: - Navigation
extension ExercisesViewController {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == EditSetViewController.segueIdentifier,
let controller = segue.destination as? EditSetViewController,
let tuple = sender as? (indexPath: IndexPath, set: ExerciseSet?) {
controller.delegate = self
controller.indexPath = tuple.indexPath
controller.set = tuple.set
}
}
}
// MARK: - Table view data source
extension ExercisesViewController {
override func numberOfSections(in tableView: UITableView) -> Int {
return exercises.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return exercises[section].sets.count + 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let exercise = exercises[indexPath.section]
if exercise.sets.count == indexPath.row {
return tableView.dequeueReusableCellFor(indexPath) as AddSetsCell
} else {
let set = exercise.sets[indexPath.row]
let text = NSMutableAttributedString(string: "\(String.bullet) \(ExerciseSet.titleAtIndex(indexPath.row))")
text.setAttributes([.foregroundColor: set.type.color], range: NSRange(location: 0, length: 1))
let cell: SetCell = tableView.dequeueReusableCellFor(indexPath)
cell.textLabel?.attributedText = text
return cell
}
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return Exercise.titleAtIndex(section)
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let set = exercises[indexPath.section].sets.count == indexPath.row ? nil : exercises[indexPath.section].sets[indexPath.row]
performSegue(withIdentifier: EditSetViewController.segueIdentifier, sender: (indexPath, set))
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if (indexPath.row < exercises[indexPath.section].sets.count) {
exercises[indexPath.section].sets.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
tableView.reloadSections(IndexSet(arrayLiteral: indexPath.section), with: .automatic)
} else {
exercises.remove(at: indexPath.section)
tableView.deleteSections(IndexSet(arrayLiteral: indexPath.section), with: .fade)
}
}
override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
if (indexPath.row < exercises[indexPath.section].sets.count) {
let delete = UITableViewRowAction(style: .destructive, title: "Delete") { (action, indexPath) in
self.exercises[indexPath.section].sets.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
tableView.reloadSections(IndexSet(arrayLiteral: indexPath.section), with: .automatic)
}
return [delete]
}
return nil
}
}
// MARK: - AddSetControllerDelegate
extension ExercisesViewController: EditSetViewControllerDelegate {
func editSetViewControllerDidAddSet(_ set: ExerciseSet, at indexPath: IndexPath) {
let exercise = exercises[indexPath.section]
let index = set.type == .regular ? indexPath.row : exercise.sets.firstIndex { (set) -> Bool in
set.type == .regular
} ?? 0
exercise.sets.insert(set, at: index)
tableView.insertRows(at: [indexPath], with: .automatic)
tableView.reloadSections(IndexSet(arrayLiteral: indexPath.section), with: .none)
}
func editSetViewControllerDidEditSet(_ set: ExerciseSet, at indexPath: IndexPath) {
let exercise = exercises[indexPath.section]
let oldSet = exercise.sets[indexPath.row]
guard oldSet.type != set.type else { return }
exercise.sets.remove(at: indexPath.row)
let index = set.type == .regular ? indexPath.row : exercise.sets.firstIndex { (set) -> Bool in
set.type == .regular
} ?? 0
exercise.sets.insert(set, at: index)
tableView.reloadSections(IndexSet(arrayLiteral: indexPath.section), with: .none)
}
}
| 36.442177 | 137 | 0.647751 |
6e3f5d3292ff0542c30a335b424ca677cba52583 | 29,403 | sql | SQL | infh4361_akademik.sql | aliyakub727/akademik | f46ead89a98bac1388353c51decf2fd84b0397d8 | [
"MIT"
] | null | null | null | infh4361_akademik.sql | aliyakub727/akademik | f46ead89a98bac1388353c51decf2fd84b0397d8 | [
"MIT"
] | null | null | null | infh4361_akademik.sql | aliyakub727/akademik | f46ead89a98bac1388353c51decf2fd84b0397d8 | [
"MIT"
] | 1 | 2021-09-25T09:03:27.000Z | 2021-09-25T09:03:27.000Z | -- phpMyAdmin SQL Dump
-- version 4.9.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Waktu pembuatan: 10 Okt 2021 pada 11.06
-- Versi server: 10.2.40-MariaDB-cll-lve
-- Versi PHP: 7.3.30
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: `infh4361_akademik`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_activation_attempts`
--
CREATE TABLE `auth_activation_attempts` (
`id` int(11) UNSIGNED NOT NULL,
`ip_address` varchar(255) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`token` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_groups`
--
CREATE TABLE `auth_groups` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `auth_groups`
--
INSERT INTO `auth_groups` (`id`, `name`, `description`) VALUES
(1, 'admin', 'Admin'),
(2, 'operator', 'Operator'),
(3, 'siswa', 'Siswa'),
(4, 'guru', 'Guru'),
(5, 'kepala_sekolah', 'Kepala Sekolah');
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_groups_permissions`
--
CREATE TABLE `auth_groups_permissions` (
`group_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
`permission_id` int(11) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_groups_users`
--
CREATE TABLE `auth_groups_users` (
`group_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
`user_id` int(11) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `auth_groups_users`
--
INSERT INTO `auth_groups_users` (`group_id`, `user_id`) VALUES
(1, 23),
(2, 27),
(2, 31),
(3, 29),
(4, 28),
(5, 30);
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_logins`
--
CREATE TABLE `auth_logins` (
`id` int(11) UNSIGNED NOT NULL,
`ip_address` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`user_id` int(11) UNSIGNED DEFAULT NULL,
`date` datetime NOT NULL,
`success` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `auth_logins`
--
INSERT INTO `auth_logins` (`id`, `ip_address`, `email`, `user_id`, `date`, `success`) VALUES
(1, '::1', 'cobain11', 2, '2021-09-13 21:40:02', 0),
(2, '::1', 'cobain11', 7, '2021-09-13 21:53:39', 0),
(3, '::1', 'admin', 20, '2021-09-15 03:43:06', 0),
(4, '::1', 'admin', 20, '2021-09-15 03:43:25', 0),
(5, '::1', 'admin', 20, '2021-09-15 03:43:44', 0),
(6, '::1', 'admin', 20, '2021-09-15 03:44:20', 0),
(7, '::1', 'aliyakub', 21, '2021-09-15 03:46:04', 0),
(8, '::1', 'anwar@gmail.com', 22, '2021-09-15 03:49:07', 1),
(9, '::1', 'anwar@gmail.com', 22, '2021-09-15 03:51:56', 1),
(10, '::1', 'anwar@gmail.com', 22, '2021-09-15 03:52:41', 1),
(11, '::1', 'aliyakub', NULL, '2021-09-18 03:59:09', 0),
(12, '::1', 'aliyakub', NULL, '2021-09-18 23:39:01', 0),
(13, '::1', 'aliyakub', NULL, '2021-09-18 23:40:15', 0),
(14, '::1', 'aliyakub', NULL, '2021-09-18 23:40:40', 0),
(15, '::1', 'aliyakub', NULL, '2021-09-18 23:42:45', 0),
(16, '::1', 'aliyakub', NULL, '2021-09-18 23:43:35', 0),
(17, '::1', 'aliyakub', NULL, '2021-09-18 23:44:10', 0),
(18, '::1', 'aliyakub', NULL, '2021-09-18 23:45:11', 0),
(19, '::1', 'anwar@gmail.com', 22, '2021-09-18 23:46:08', 1),
(20, '::1', 'aliyakub727@gmail.com', 23, '2021-09-18 23:58:47', 1),
(21, '::1', 'aliyakub727@gmail.com', 23, '2021-09-20 07:06:01', 1),
(22, '::1', 'aliyakub727@gmail.com', 23, '2021-09-21 05:08:06', 1),
(23, '::1', 'aliyakub727@gmail.com', 23, '2021-09-21 05:12:49', 1),
(24, '::1', 'aliyakub727@gmail.com', 23, '2021-09-21 05:39:05', 1),
(25, '::1', 'aliyakub', NULL, '2021-09-23 22:42:53', 0),
(26, '::1', 'aliyakub727@gmail.com', 23, '2021-09-23 22:43:05', 1),
(27, '::1', 'aliyakub727@gmail.com', 23, '2021-09-23 22:59:39', 1),
(28, '::1', 'aliyakub727@gmail.com', 23, '2021-09-25 02:54:38', 1),
(29, '::1', 'aliyakub727@gmail.com', 23, '2021-09-26 21:57:29', 1),
(30, '::1', 'aliyakub727@gmail.com', 23, '2021-09-26 21:57:31', 1),
(31, '::1', 'aliyakub727@gmail.com', 23, '2021-09-27 23:07:27', 1),
(32, '::1', 'dafitgila@gmail.com', 25, '2021-10-02 02:42:24', 1),
(33, '::1', 'aliyakub727@gmail.com', 23, '2021-10-02 10:29:11', 1),
(34, '::1', 'aliyakub727@gmail.com', 23, '2021-10-03 06:45:20', 1),
(35, '::1', 'aliyakub727@gmail.com', 23, '2021-10-05 02:12:55', 1),
(36, '::1', 'aliyakub727@gmail.com', 23, '2021-10-06 03:58:46', 1),
(37, '114.124.195.164', 'aliyakub727@gmail.com', 23, '2021-10-06 07:48:42', 1),
(38, '114.124.195.36', 'aliyakub727@gmail.com', 23, '2021-10-06 07:54:21', 1),
(39, '114.124.195.164', 'aliyakub727@gmail.com', 23, '2021-10-06 08:08:12', 1),
(40, '114.124.195.36', 'dafitgila@gmail.com', 27, '2021-10-06 08:31:37', 1),
(41, '101.255.132.101', 'aliyakub727@gmail.com', 23, '2021-10-06 20:06:55', 1),
(42, '101.255.132.101', 'aliyakub727@gmail.com', 23, '2021-10-06 20:28:31', 1),
(43, '101.255.132.101', 'dafitgila@gmail.com', 27, '2021-10-06 20:29:39', 1),
(44, '101.255.132.101', 'dafitgila@gmail.com', 27, '2021-10-06 20:29:39', 1),
(45, '101.255.132.101', 'dafitgila@gmail.com', 27, '2021-10-06 20:40:13', 1),
(46, '101.255.132.101', 'dafitgila@gmail.com', 27, '2021-10-06 20:49:16', 1),
(47, '180.244.164.120', 'aliyakub727@gmail.com', 23, '2021-10-06 22:40:28', 1),
(48, '180.244.164.120', 'dafitgila@gmail.com', 27, '2021-10-06 22:41:15', 1),
(49, '180.243.248.203', 'aliyakub727@gmail.com', 23, '2021-10-06 23:31:34', 1),
(50, '180.243.248.203', 'dafitgila@gmail.com', 27, '2021-10-06 23:32:47', 1),
(51, '180.243.248.203', 'aliyakub727@gmail.com', 23, '2021-10-06 23:42:00', 1),
(52, '180.243.248.203', 'dafitgila@gmail.com', 27, '2021-10-06 23:46:43', 1),
(53, '114.124.131.1', 'aliyakub727@gmail.com', 23, '2021-10-06 23:54:13', 1),
(54, '114.124.130.1', 'dafitgila@gmail.com', 27, '2021-10-07 00:03:15', 1),
(55, '180.243.248.203', 'rayhan@gmail.com', 28, '2021-10-07 00:17:26', 1),
(56, '180.243.248.203', 'aliyakub727@gmail.com', 23, '2021-10-07 00:18:06', 1),
(57, '140.213.13.47', 'aliyakub727@gmail.com', 23, '2021-10-07 00:19:36', 1),
(58, '140.213.13.47', 'dafitgila@gmail.com', 27, '2021-10-07 00:20:18', 1),
(59, '114.124.131.65', 'aliyakub727@gmail.com', 23, '2021-10-07 00:22:04', 1),
(60, '180.243.248.203', 'dafitgila@gmail.com', 27, '2021-10-07 00:23:25', 1),
(61, '114.124.131.1', 'dafitgila@gmail.com', 27, '2021-10-07 00:29:44', 1),
(62, '180.243.248.203', 'aliyakub727@gmail.com', 23, '2021-10-07 00:31:58', 1),
(63, '180.243.248.203', 'dafitgila@gmail.com', 27, '2021-10-07 00:50:19', 1),
(64, '114.124.195.177', 'dafitgila@gmail.com', 27, '2021-10-08 08:29:08', 1),
(65, '182.0.198.229', 'dafitgila@gmail.com', 27, '2021-10-08 23:33:42', 1),
(66, '180.252.141.116', 'aliyakub727@gmail.com', 23, '2021-10-09 02:19:30', 1),
(67, '180.252.141.116', 'dafitgila@gmail.com', 27, '2021-10-09 02:22:49', 1),
(68, '180.252.141.116', 'aliyakub727@gmail.com', 23, '2021-10-09 02:28:04', 1),
(69, '101.128.125.122', 'aliyakub727@gmail.com', 23, '2021-10-09 03:57:28', 1),
(70, '101.128.125.122', 'dafitgila@gmail.com', 27, '2021-10-09 03:58:07', 1),
(71, '101.128.125.122', 'rayhan@gmail.com', 28, '2021-10-09 04:01:40', 1),
(72, '114.124.195.49', 'aliyakub727@gmail.com', 23, '2021-10-09 06:53:40', 1),
(73, '114.124.195.49', 'dafitgila@gmail.com', 27, '2021-10-09 06:55:09', 1),
(74, '114.124.195.177', 'aliyakub727@gmail.com', 23, '2021-10-09 07:07:03', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_permissions`
--
CREATE TABLE `auth_permissions` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_reset_attempts`
--
CREATE TABLE `auth_reset_attempts` (
`id` int(11) UNSIGNED NOT NULL,
`email` varchar(255) NOT NULL,
`ip_address` varchar(255) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`token` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_tokens`
--
CREATE TABLE `auth_tokens` (
`id` int(11) UNSIGNED NOT NULL,
`selector` varchar(255) NOT NULL,
`hashedValidator` varchar(255) NOT NULL,
`user_id` int(11) UNSIGNED NOT NULL,
`expires` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `auth_users_permissions`
--
CREATE TABLE `auth_users_permissions` (
`user_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
`permission_id` int(11) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struktur dari tabel `guru`
--
CREATE TABLE `guru` (
`id_guru` int(11) NOT NULL,
`id_mapel` int(11) NOT NULL,
`nama_guru` varchar(50) NOT NULL,
`alamat` varchar(255) NOT NULL,
`no_telp` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `guru`
--
INSERT INTO `guru` (`id_guru`, `id_mapel`, `nama_guru`, `alamat`, `no_telp`) VALUES
(3, 1, 'Hadi Nur Dianto S.Sos', 'Jl. Mawar', '081252149624'),
(4, 10, 'Desi S.Kom', 'GRIYA', '081295976123'),
(6, 2, 'Dr.Suprayekti, M.Pd', 'GRIYA ALAM SENTOSA', '081412348912'),
(8, 4, 'Dr.Khaerudin, M.Pd', 'Kp. Bakom', '081345678921'),
(9, 3, 'Dr.Robinson Situmorang, M.Pd', 'Cililitan', '081349992213'),
(10, 5, 'Imaningtyas, S.Pd. , M.Pd', 'Cengkareng', '081295976042'),
(11, 6, 'Yustia Suntari ,S.Pd. ,M.Pd', 'Cileungsi', '081345678945'),
(12, 7, 'Dr.Nidya Suntari ,S.Pd. ,M.Si', 'Depok', '081295976077'),
(13, 8, 'Dr.Gusti Yarmi, M.Pd', 'Cikeas', '081322919184'),
(14, 9, 'Drs. Sutrisno, M.Si', 'Gunung Putri', '081322919183'),
(15, 11, 'Dr.Iva, M.Pd', 'Bogor', '089156782912'),
(16, 11, 'Dr.Iva, M.Pd', 'Bogor', '089156782912'),
(17, 11, 'Dr.Iva Sagita, M.Pd', 'Bogor', '089156782911'),
(18, 11, 'Dr.Iva Sagita, M.Pd', 'Bogor', '089156782911'),
(19, 12, 'Dr.Yurniwati, M.Pd', 'Bekasi', '089212548912'),
(20, 12, 'Dr.Khaerr, M.Pd', 'Bantar Gebang', '089156782915'),
(21, 25, 'Dr.Rendi, M.Pd', 'Bekasi', '089156781234'),
(22, 24, 'Dr.Eva, M.Pd', 'Depok', '089156782124'),
(23, 23, 'Hadi Rone S.Kom', 'Jakarta Timur', '089156782914'),
(24, 22, 'Dr.Cinendi, M.Pd', 'Cinere', '089156782911'),
(25, 21, 'Dr.Karsih Yarmi, M.Pd', 'Ciracas', '081295976044'),
(26, 20, 'Dr.Herdi, M.Pd', 'Pasar Rebo', '089212548990'),
(27, 21, 'Wening Cahya, M.Pd', 'Jakarta Selatan', '081322919184'),
(28, 19, 'Dr.Rodrigo, M.Pd', 'Bogor', '089212548912'),
(29, 17, 'Nur Dianto S.Sos', 'Cibubur', '089212548948');
-- --------------------------------------------------------
--
-- Struktur dari tabel `jadwal`
--
CREATE TABLE `jadwal` (
`id_jadwal` int(11) NOT NULL,
`id_guru` int(11) NOT NULL,
`id_mapel` int(11) NOT NULL,
`kelas` varchar(30) NOT NULL,
`hari` varchar(10) NOT NULL,
`jam` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `jurusan`
--
CREATE TABLE `jurusan` (
`id_jurusan` int(11) NOT NULL,
`jurusan` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `jurusan`
--
INSERT INTO `jurusan` (`id_jurusan`, `jurusan`) VALUES
(1, 'Teknik Informatika Komputer'),
(2, 'Akuntansi'),
(3, 'Administrasi Perkantoran'),
(4, 'Multi Media'),
(5, 'Rekayasa Perangkat Lunak');
-- --------------------------------------------------------
--
-- Struktur dari tabel `kelas`
--
CREATE TABLE `kelas` (
`id` int(11) NOT NULL,
`kelas` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `kelas`
--
INSERT INTO `kelas` (`id`, `kelas`) VALUES
(2, '18IK');
-- --------------------------------------------------------
--
-- Struktur dari tabel `mapel`
--
CREATE TABLE `mapel` (
`id_mapel` int(11) NOT NULL,
`nama_mapel` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `mapel`
--
INSERT INTO `mapel` (`id_mapel`, `nama_mapel`) VALUES
(1, 'IPA'),
(2, 'MATEMATIKA'),
(3, 'PENDIDIKAN AGAMA DAN BUDI PEKERTI'),
(4, 'PENDIDIKAN PANCASILA DAN KEWARGANEGARAAN'),
(5, 'BAHASA INDONESIA'),
(6, 'ILMU PENGETAHUAN SOSIAL'),
(7, 'SENI BUDAYA DAN PRAKARYA'),
(8, 'PENDIDIKAN JASMANI DAN KESEHATAN'),
(9, 'KEWIRAUSAHAAN'),
(10, 'BAHASA INGGRIS'),
(11, 'FISIKA'),
(12, 'KIMIA'),
(13, 'SIMULASI DIGITAL'),
(14, 'SISTEM KOMPUTER'),
(15, 'PEMOGRAMAN DASAR'),
(16, 'SISTEM OPERASI'),
(17, 'kimia'),
(18, 'PEMODELAN PERANGKAT LUNAK'),
(19, 'ADMINISTRASI BASIS DATA'),
(20, 'PEMOGRAMAN GRAFIK'),
(21, 'TEKNIK ANIMASI 3D'),
(22, 'DESAIN MULTIMEDIA'),
(23, 'TEKNIK PENGOLAHAN VIDIO'),
(24, 'ADMINISTRASI SERVER'),
(25, 'KEAMANAN JARINGAN'),
(26, 'Olahraga');
-- --------------------------------------------------------
--
-- Struktur dari tabel `master_data`
--
CREATE TABLE `master_data` (
`id` int(11) NOT NULL,
`tahun_ajaran` varchar(20) NOT NULL,
`nis` varchar(16) NOT NULL,
`nama_lengkap` varchar(255) NOT NULL,
`kelas` varchar(10) NOT NULL,
`jurusan` varchar(50) NOT NULL,
`nama_walikelas` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `master_data`
--
INSERT INTO `master_data` (`id`, `tahun_ajaran`, `nis`, `nama_lengkap`, `kelas`, `jurusan`, `nama_walikelas`) VALUES
(3, '2020-2021', '1241240512', 'anwar udin', '19AK01', 'Akuntansi', 'bu dea'),
(4, '2019-2020', '1223132', 'dafit alpiqri', '19TKJ01', 'Teknik Komputer Jaringan', 'bangmaman'),
(5, '2020-2021', '455221', 'anwar', '18ik', 'Teknik Informatika Komputer', 'bangmaman');
-- --------------------------------------------------------
--
-- Struktur dari tabel `migrations`
--
CREATE TABLE `migrations` (
`id` bigint(20) UNSIGNED NOT NULL,
`version` varchar(255) NOT NULL,
`class` varchar(255) NOT NULL,
`group` varchar(255) NOT NULL,
`namespace` varchar(255) NOT NULL,
`time` int(11) NOT NULL,
`batch` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `migrations`
--
INSERT INTO `migrations` (`id`, `version`, `class`, `group`, `namespace`, `time`, `batch`) VALUES
(1, '2017-11-20-223112', 'Myth\\Auth\\Database\\Migrations\\CreateAuthTables', 'default', 'Myth\\Auth', 1631542522, 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `nilai`
--
CREATE TABLE `nilai` (
`id_nilai` int(11) NOT NULL,
`id_mapel` int(11) NOT NULL,
`nis` varchar(16) NOT NULL,
`kelas` varchar(30) NOT NULL,
`tugas` int(11) NOT NULL,
`uts` int(11) NOT NULL,
`uas` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `siswa`
--
CREATE TABLE `siswa` (
`id` int(11) NOT NULL,
`nama_lengkap` varchar(255) NOT NULL,
`jenis_kelamin` varchar(10) NOT NULL,
`nis` varchar(16) NOT NULL,
`alamat` varchar(255) NOT NULL,
`no_telp` varchar(20) NOT NULL,
`tgl_lahir` date NOT NULL,
`tempat_lahir` varchar(255) NOT NULL,
`agama` varchar(20) NOT NULL,
`nama_orangtua` varchar(255) NOT NULL,
`alamat_orangtua` varchar(255) NOT NULL,
`no_telp_orangtua` varchar(20) NOT NULL,
`jurusan` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `siswa`
--
INSERT INTO `siswa` (`id`, `nama_lengkap`, `jenis_kelamin`, `nis`, `alamat`, `no_telp`, `tgl_lahir`, `tempat_lahir`, `agama`, `nama_orangtua`, `alamat_orangtua`, `no_telp_orangtua`, `jurusan`) VALUES
(2, 'Anwar Udin', 'Laki-Laki', '4552211', 'canadian', '081295976012', '2021-09-24', 'BAWAH JEMBATAN', 'Budha', 'XXXX', 'xxxx', '7675434', 'Akuntansi'),
(3, 'Ali Yakub Biantoro', 'Laki-Laki', '1918181', 'bekasi', '089818181', '2001-01-04', 'bekasi', 'Islam', 'Muh Yakub', 'bekasi', '099181811', 'Teknik Komputer Jaringan'),
(4, 'Raka Surendra', 'Laki-Laki', '1234567', 'DESA GANDOANG', '089212548945', '2001-09-27', 'Bogor', 'Islam', 'Rendi', 'DESA GANDOANG', '089212548666', 'Rekayasa Perangkat Lunak'),
(5, 'Deki Losmi', 'Laki-Laki', '0989581', 'Desa Cikeas', '089156782934', '2001-10-06', 'Jakarta', 'Islam', 'Andono', 'Desa Cikeas', '089822466795', 'Teknik Komputer Jaringan'),
(6, 'Chalisa Salsabila Fitri', 'Perempuan', '2456789', 'Desa Cikino', '084656958593', '2002-10-13', 'Jakarta', 'Islam', 'Hanon', 'Desa Cikini', '083809482934', 'Rekayasa Perangkat Lunak'),
(7, 'Muhammad Parij', 'Laki-Laki', '8678591', 'Desa Cikerewis', '083456940022', '2001-10-19', 'Bandung', 'Islam', 'Wandi', 'Desa Cikerewis', '083958321259', 'Multimedia'),
(8, 'Bambang', 'Laki-Laki', '0892359', 'Desa Cijantung', '081322912910', '2001-10-18', 'Bogor', 'Islam', 'Sinjan', 'Desa Cijantung', '089822466333', 'Rekayasa Perangkat Lunak'),
(9, 'Yuni Angsini', 'Perempuan', '4552256', 'Desa Ciangsana', '0813229191992', '2001-10-20', 'Jakarta', 'Islam', 'Wahyu', 'Desa Ciangsana', '089822466222', 'Rekayasa Perangkat Lunak'),
(10, 'Rara Raita', 'Perempuan', '4555515', 'Desa Gino', '081295944412', '2001-10-05', 'Jakarta', 'Islam', 'Antoro', 'Desa Gino', '083412348921', 'Multimedia'),
(11, 'Rahman Suhendi', 'Laki-Laki', '0989234', 'Desa Gandoang', '081295944333', '2002-10-19', 'Jakarta', 'Islam', 'Rendi', 'Desa Gandoang', '089822466222', 'Administrasi Perkantoran'),
(12, 'Andi Suhren', 'Laki-Laki', '0982781', 'Desa Gandoang Kali sari', '0892148278192', '2002-10-26', 'Bekasi', 'Islam', 'Kona', 'Desa Gandoang Kali sari', '089822464901', 'Akuntansi'),
(13, 'Rohmawati Sinta', 'Perempuan', '0812345', 'Desa Sukasari', '082134569021', '2001-10-19', 'Bekasi', 'Islam', 'Joko', 'Desa Sukasari', '083249021234', 'Akuntansi'),
(14, 'Tresna Rido', 'Laki-Laki', '0212931', 'Desa Sukasari Kali Malang', '082329389412', '2001-10-23', 'Bogor', 'Islam', 'Reto', 'Desa Sukasari Kali Malang', '082313459412', 'Administrasi Perkantoran'),
(15, 'Windi Putri', 'Perempuan', '9281293', 'Desa Cibubur', '0813229191333', '2002-10-26', 'Jakarta', 'Islam', 'Roti', 'Desa Cibubur', '089822466556', 'Teknik Komputer Jaringan'),
(16, 'Risman Woto', 'Laki-Laki', '4552333', 'Desa Cibubur Jongol', '089212548444', '2001-10-19', 'Jakarta', 'Hindu', 'Aroro', 'Desa Cibubur Jongol', '089822464333', 'Administrasi Perkantoran'),
(17, 'Edi Gunadi', 'Laki-Laki', '1234333', 'Desa Jongol', '081295976312', '2001-10-17', 'Bogor', 'Budha', 'Rendi', 'Desa Jongol', '089822466666', 'Rekayasa Perangkat Lunak'),
(18, 'Raden Kian Santang', 'Laki-Laki', '2355672', 'Desa Sukamakmur', '089212548121', '2001-10-21', 'Bogor', 'Islam', 'Prabu Siliwangi', 'Desa Sukamakmur', '081982246990', 'Akuntansi'),
(19, 'Adul Rinto', 'Laki-Laki', '0928192', 'Desa Sukamakmur Bantar Gebang', '082198221234', '2001-10-21', 'Jakarta', 'Islam', 'Muh Yakub', 'Desa Sukamakmur Bantar Gebang', '089833266222', 'Akuntansi'),
(20, 'Aulia Santi', 'Perempuan', '4552555', 'Desa Sukamakmur Bantar Gebang Sode', '081295976444', '2002-10-30', 'Bogor', 'Kristen', 'Andono', 'Desa Sukamakmur Bantar Gebang Sode', '089822466678', 'Rekayasa Perangkat Lunak'),
(21, 'Yuliana Anggrei', 'Perempuan', '4552565', 'Desa Setu', '089212548933', '2001-10-26', 'Bogor', 'Islam', 'Roney', 'Desa Setu', '089822466512', 'Akuntansi'),
(22, 'Eka Putri', 'Perempuan', '1234447', 'Desa Setu Serang', '084656958533', '2001-10-29', 'Jakarta', 'Islam', 'Andin', 'Desa Setu Serang', '089822466251', 'Teknik Komputer Jaringan'),
(23, 'Dika Randi', 'Laki-Laki', '4552244', 'Desa Setu Serang', '089212548944', '2001-10-27', 'Bogor', 'Islam', 'Oki', 'Desa Setu Serang', '089822466491', 'Teknik Komputer Jaringan'),
(24, 'Ari Lasso', 'Laki-Laki', '1234777', 'Desa Setu Serang', '089212548941', '2002-10-26', 'Jakarta', 'Islam', 'Rendi', 'Desa Setu Serang', '089822461231', 'Akuntansi'),
(25, 'Febri Ardianto', 'Laki-Laki', '81291291', 'Desa Setu Serang Bekasi', '089212543123', '2001-10-11', 'Bogor', 'Hindu', 'Rento', 'Desa Setu Serang Bekasi', '082134589212', 'Teknik Komputer Jaringan'),
(26, 'Lionel Messi', 'Laki-Laki', '0982782', 'Desa Setu Serang Bekasi', '089156782333', '2001-01-05', 'Bogor', 'Kristen', 'Bondan', 'Desa Setu Serang Bekasi', '089833466222', 'Rekayasa Perangkat Lunak');
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id` int(11) UNSIGNED NOT NULL,
`email` varchar(255) NOT NULL,
`username` varchar(30) DEFAULT NULL,
`password_hash` varchar(255) NOT NULL,
`reset_hash` varchar(255) DEFAULT NULL,
`reset_at` datetime DEFAULT NULL,
`reset_expires` datetime DEFAULT NULL,
`activate_hash` varchar(255) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`status_message` varchar(255) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT 0,
`force_pass_reset` tinyint(1) NOT NULL DEFAULT 0,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data untuk tabel `users`
--
INSERT INTO `users` (`id`, `email`, `username`, `password_hash`, `reset_hash`, `reset_at`, `reset_expires`, `activate_hash`, `status`, `status_message`, `active`, `force_pass_reset`, `created_at`, `updated_at`, `deleted_at`) VALUES
(23, 'aliyakub727@gmail.com', 'aliyakub', '$2y$10$Xdb1Mm2JAfjDvRiBoh4sIu9/HNrsn3G3oDsCEnkU9mTURjRUUFpCy', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2021-09-18 23:58:39', '2021-09-18 23:58:39', NULL),
(27, 'dafitgila@gmail.com', 'operator', '$2y$10$BJJe0eK2So06t4q9MoAwreIw32hQ9jtJt8oXtATH4kCuB1Y6CVeHq', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2021-10-06 08:26:32', '2021-10-06 08:26:32', NULL),
(28, 'rayhan@gmail.com', 'guru', '$2y$10$6wW344if8SIhHFZeuwqejO2/82WDt0ZhD6HXHjWQgTyJ5XJabRmOi', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2021-10-06 08:27:24', '2021-10-06 08:27:24', NULL),
(29, 'adnan@gmail.com', 'siswa', '$2y$10$KhCAGqK.l2r7bxp1Rzp9vePrNYrvEhsazYBD6vZ095/YapmjhZjCK', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2021-10-06 08:27:54', '2021-10-06 08:27:54', NULL),
(30, 'anwar@gmail.com', 'kepalasekolah', '$2y$10$7j4b6HdovN6fh5rtl/ZY2eQAmVvZ/MsT1I1tE7UkUZsCZnwJakXqC', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2021-10-06 08:28:19', '2021-10-06 08:28:19', NULL),
(31, 'dafitnur900@gmail.com', 'dafit', '$2y$10$HaNtwxlZhiMYXcTYpi1Z9uOH5ESoJpAlFjW0/jIGmWpAgVPOvNiga', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2021-10-07 00:37:30', '2021-10-07 00:37:30', NULL);
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `auth_activation_attempts`
--
ALTER TABLE `auth_activation_attempts`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `auth_groups`
--
ALTER TABLE `auth_groups`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `auth_groups_permissions`
--
ALTER TABLE `auth_groups_permissions`
ADD KEY `auth_groups_permissions_permission_id_foreign` (`permission_id`),
ADD KEY `group_id_permission_id` (`group_id`,`permission_id`);
--
-- Indeks untuk tabel `auth_groups_users`
--
ALTER TABLE `auth_groups_users`
ADD KEY `auth_groups_users_user_id_foreign` (`user_id`),
ADD KEY `group_id_user_id` (`group_id`,`user_id`);
--
-- Indeks untuk tabel `auth_logins`
--
ALTER TABLE `auth_logins`
ADD PRIMARY KEY (`id`),
ADD KEY `email` (`email`),
ADD KEY `user_id` (`user_id`);
--
-- Indeks untuk tabel `auth_permissions`
--
ALTER TABLE `auth_permissions`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `auth_reset_attempts`
--
ALTER TABLE `auth_reset_attempts`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `auth_tokens`
--
ALTER TABLE `auth_tokens`
ADD PRIMARY KEY (`id`),
ADD KEY `auth_tokens_user_id_foreign` (`user_id`),
ADD KEY `selector` (`selector`);
--
-- Indeks untuk tabel `auth_users_permissions`
--
ALTER TABLE `auth_users_permissions`
ADD KEY `auth_users_permissions_permission_id_foreign` (`permission_id`),
ADD KEY `user_id_permission_id` (`user_id`,`permission_id`);
--
-- Indeks untuk tabel `guru`
--
ALTER TABLE `guru`
ADD PRIMARY KEY (`id_guru`);
--
-- Indeks untuk tabel `jadwal`
--
ALTER TABLE `jadwal`
ADD PRIMARY KEY (`id_jadwal`),
ADD KEY `id_guru` (`id_guru`),
ADD KEY `id_mapel` (`id_mapel`);
--
-- Indeks untuk tabel `jurusan`
--
ALTER TABLE `jurusan`
ADD PRIMARY KEY (`id_jurusan`);
--
-- Indeks untuk tabel `kelas`
--
ALTER TABLE `kelas`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `mapel`
--
ALTER TABLE `mapel`
ADD PRIMARY KEY (`id_mapel`);
--
-- Indeks untuk tabel `master_data`
--
ALTER TABLE `master_data`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `nilai`
--
ALTER TABLE `nilai`
ADD PRIMARY KEY (`id_nilai`),
ADD KEY `id_mapel` (`id_mapel`),
ADD KEY `nis` (`nis`);
--
-- Indeks untuk tabel `siswa`
--
ALTER TABLE `siswa`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `auth_activation_attempts`
--
ALTER TABLE `auth_activation_attempts`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `auth_groups`
--
ALTER TABLE `auth_groups`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT untuk tabel `auth_logins`
--
ALTER TABLE `auth_logins`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=75;
--
-- AUTO_INCREMENT untuk tabel `auth_permissions`
--
ALTER TABLE `auth_permissions`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `auth_reset_attempts`
--
ALTER TABLE `auth_reset_attempts`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `auth_tokens`
--
ALTER TABLE `auth_tokens`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `guru`
--
ALTER TABLE `guru`
MODIFY `id_guru` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT untuk tabel `jadwal`
--
ALTER TABLE `jadwal`
MODIFY `id_jadwal` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `jurusan`
--
ALTER TABLE `jurusan`
MODIFY `id_jurusan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT untuk tabel `kelas`
--
ALTER TABLE `kelas`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT untuk tabel `mapel`
--
ALTER TABLE `mapel`
MODIFY `id_mapel` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT untuk tabel `master_data`
--
ALTER TABLE `master_data`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `nilai`
--
ALTER TABLE `nilai`
MODIFY `id_nilai` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `siswa`
--
ALTER TABLE `siswa`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
--
-- AUTO_INCREMENT untuk tabel `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--
--
-- Ketidakleluasaan untuk tabel `auth_groups_permissions`
--
ALTER TABLE `auth_groups_permissions`
ADD CONSTRAINT `auth_groups_permissions_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `auth_groups` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `auth_groups_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `auth_permissions` (`id`) ON DELETE CASCADE;
--
-- Ketidakleluasaan untuk tabel `auth_groups_users`
--
ALTER TABLE `auth_groups_users`
ADD CONSTRAINT `auth_groups_users_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `auth_groups` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `auth_groups_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Ketidakleluasaan untuk tabel `auth_tokens`
--
ALTER TABLE `auth_tokens`
ADD CONSTRAINT `auth_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Ketidakleluasaan untuk tabel `auth_users_permissions`
--
ALTER TABLE `auth_users_permissions`
ADD CONSTRAINT `auth_users_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `auth_permissions` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `auth_users_permissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 36.525466 | 231 | 0.646363 |
3f0e821785913df353bf0cfe62cf80e016bcac0a | 752 | dart | Dart | workflow/lib/component/release/release_upload.dart | hxinGood/magpie | 4bfaa1f698f052c74a17e19ac31cb18d8e275e92 | [
"BSD-3-Clause"
] | null | null | null | workflow/lib/component/release/release_upload.dart | hxinGood/magpie | 4bfaa1f698f052c74a17e19ac31cb18d8e275e92 | [
"BSD-3-Clause"
] | null | null | null | workflow/lib/component/release/release_upload.dart | hxinGood/magpie | 4bfaa1f698f052c74a17e19ac31cb18d8e275e92 | [
"BSD-3-Clause"
] | null | null | null | import 'package:flutter/material.dart';
import '../widget/container_extension.dart';
import 'release_upload_android.dart';
import 'release_upload_ios.dart';
///上传发布
class ReleaseUpload extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(20),
width: double.infinity,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'上传',
style: TextStyle(fontSize: 18),
),
),
),
ReleaseUploadAndroid(),
ReleaseUploadIos(),
],
),
).asCard;
}
}
| 23.5 | 47 | 0.550532 |
42b7276f8b8f80d4401d4908d666689cebef2793 | 1,038 | lua | Lua | sample_desc/cdc_acm5_desc.lua | teenydt/teenydt.github.io | 4e5651fe12cff8be378d2e5d2a5c91900e22b1b4 | [
"MIT"
] | 11 | 2020-06-16T03:22:40.000Z | 2022-03-27T00:04:08.000Z | sample_desc/cdc_acm5_desc.lua | teenydt/teenydt.github.io | 4e5651fe12cff8be378d2e5d2a5c91900e22b1b4 | [
"MIT"
] | 2 | 2019-12-13T03:16:00.000Z | 2021-02-10T02:38:30.000Z | sample_desc/cdc_acm5_desc.lua | teenydt/teenydt.github.io | 4e5651fe12cff8be378d2e5d2a5c91900e22b1b4 | [
"MIT"
] | 8 | 2019-11-06T06:08:55.000Z | 2022-01-08T04:58:22.000Z | return Device {
strManufacturer = "TeenyUSB",
strProduct = "TeenyUSB CDC5 DEMO",
strSerial = "TUSB123456",
idVendor = 0x0483,
idProduct = 0x0011,
prefix = "CDC_ACM5",
Config {
CDC_ACM{
EndPoint(IN(8), Interrupt, 16),
EndPoint(IN(1), BulkDouble, 32),
EndPoint(OUT(1), BulkDouble, 32),
},
CDC_ACM{
EndPoint(IN(9), Interrupt, 16),
EndPoint(IN(2), BulkDouble, 32),
EndPoint(OUT(2), BulkDouble, 32),
},
CDC_ACM{
EndPoint(IN(10), Interrupt, 16),
EndPoint(IN(3), BulkDouble, 32),
EndPoint(OUT(3), BulkDouble, 32),
},
CDC_ACM{
EndPoint(IN(11), Interrupt, 16),
EndPoint(IN(4), BulkDouble, 32),
EndPoint(OUT(4), BulkDouble, 32),
},
CDC_ACM{
EndPoint(IN(12), Interrupt, 16),
EndPoint(IN(5), BulkDouble, 32),
EndPoint(OUT(5), BulkDouble, 32),
},
}
} | 29.657143 | 46 | 0.493256 |
38d4e7605d14a66153dc9d8e201703ab30a466d4 | 7,279 | h | C | System/Library/Frameworks/MapKit.framework/MKAnnotationContainerView.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | 4 | 2017-03-23T00:01:54.000Z | 2018-08-04T20:16:32.000Z | System/Library/Frameworks/MapKit.framework/MKAnnotationContainerView.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | null | null | null | System/Library/Frameworks/MapKit.framework/MKAnnotationContainerView.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | 4 | 2017-05-14T16:23:26.000Z | 2019-12-21T15:07:59.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Wednesday, March 22, 2017 at 9:06:59 AM Mountain Standard Time
* Operating System: Version 10.1 (Build 14U593)
* Image Source: /System/Library/Frameworks/MapKit.framework/MapKit
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <MapKit/MapKit-Structs.h>
#import <UIKit/UIView.h>
#import <libobjc.A.dylib/MKAnnotationCalloutControllerDelegate.h>
#import <libobjc.A.dylib/_MKPinAnnotationViewDelegate.h>
@protocol MKAnnotationContainerViewDelegate;
@class NSMutableArray, MKAnnotationView, NSMutableSet, MKAnnotationCalloutController, _MKBalloonAnnotationCalloutController, MKPinAnnotationView, UIPopoverController, NSString;
@interface MKAnnotationContainerView : UIView <MKAnnotationCalloutControllerDelegate, _MKPinAnnotationViewDelegate> {
NSMutableArray* _annotationViews;
NSMutableArray* _awaitingDropPins;
MKAnnotationView* _selectedAnnotationView;
MKAnnotationView* _annotationViewToSelect;
id<MKAnnotationContainerViewDelegate> _delegate;
MKAnnotationView* _draggingAnnotationView;
CGPoint _mouseDownPoint;
CGPoint _draggingAnnotationViewCenter;
unsigned long long _mapType;
BOOL _clickedOnAnnotationView;
BOOL _didDragAnnotationView;
MKAnnotationView* _userLocationView;
double _annotationViewsRotationRadians;
CGAffineTransform _mapTransform;
BOOL _addingSubview;
BOOL _suppressCallout;
NSMutableSet* _viewsToAnimate;
MKAnnotationCalloutController* _calloutController;
_MKBalloonAnnotationCalloutController* _balloonCalloutController;
double _mapPitchRadians;
SCD_Struct_MK13 _mapDisplayStyle;
BOOL _mapFocused;
}
@property (nonatomic,readonly) MKPinAnnotationView * bubblePin;
@property (assign,nonatomic) BOOL suppressCallout; //@synthesize suppressCallout=_suppressCallout - In the implementation block
@property (nonatomic,readonly) UIPopoverController * popoverController;
@property (assign,nonatomic) BOOL allowsPopoverWhenNotInWindow;
@property (nonatomic,readonly) MKAnnotationView * calloutAnnotationView;
@property (nonatomic,readonly) MKAnnotationView * userLocationView;
@property (assign,nonatomic,__weak) id<MKAnnotationContainerViewDelegate> delegate;
@property (nonatomic,readonly) NSMutableArray * annotationViews;
@property (assign,nonatomic) unsigned long long mapType;
@property (nonatomic,readonly) SCD_Struct_MK21 currentComparisonContext;
@property (nonatomic,readonly) BOOL hasDroppingPins;
@property (nonatomic,readonly) BOOL hasPendingAnimations;
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
-(id)initWithFrame:(CGRect)arg1 ;
-(void)setDelegate:(id<MKAnnotationContainerViewDelegate>)arg1 ;
-(void)dealloc;
-(void)addSubview:(id)arg1 ;
-(id<MKAnnotationContainerViewDelegate>)delegate;
-(CGRect)_visibleRect;
-(UIPopoverController *)popoverController;
-(BOOL)hasPendingAnimations;
-(unsigned long long)mapType;
-(void)setMapType:(unsigned long long)arg1 ;
-(CGPoint)convertCoordinate:(CLLocationCoordinate2D)arg1 toPointToView:(id)arg2 ;
-(SCD_Struct_MK1)_mapRectWithFraction:(double)arg1 ofVisible:(SCD_Struct_MK1)arg2 ;
-(MKAnnotationView *)userLocationView;
-(BOOL)calloutContainsPoint:(CGPoint)arg1 ;
-(BOOL)isCalloutExpanded;
-(CGRect)_visibleCenteringRectInView:(id)arg1 ;
-(void)setMapDisplayStyle:(SCD_Struct_MK13)arg1 ;
-(void)setMapFocused:(BOOL)arg1 ;
-(BOOL)allowsPopoverWhenNotInWindow;
-(void)setAllowsPopoverWhenNotInWindow:(BOOL)arg1 ;
-(void)_updateAnnotationView:(id)arg1 ;
-(void)suppressUpdates;
-(void)stopSuppressingUpdates;
-(void)_updateAnnotationViewPerspective;
-(void)_updateAddedAnnotationRotation:(id)arg1 ;
-(void)setAnnotationViewsRotationRadians:(double)arg1 animation:(id)arg2 ;
-(void)pinDidDrop:(id)arg1 animated:(BOOL)arg2 ;
-(void)calloutControllerDidFinishMapsTransitionExpanding:(id)arg1 ;
-(CGRect)calloutController:(id)arg1 visibleCenteringRectInAnnotationView:(id)arg2 ;
-(void)calloutController:(id)arg1 scrollToRevealCalloutWithOffset:(CGPoint)arg2 annotationCoordinate:(CLLocationCoordinate2D)arg3 completionHandler:(/*^block*/id)arg4 ;
-(void)calloutController:(id)arg1 annotationView:(id)arg2 calloutAccessoryControlTapped:(id)arg3 ;
-(void)calloutDidAppearForAnnotationView:(id)arg1 inCalloutController:(id)arg2 ;
-(void)calloutController:(id)arg1 calloutPrimaryActionTriggeredForAnnotationView:(id)arg2 ;
-(id)activeCalloutController;
-(void)setMapPitchRadians:(double)arg1 ;
-(CGRect)popoverTargetRectForSelectedAnnotationInView:(id)arg1 ;
-(void)setCalloutsShouldHaveParallax:(BOOL)arg1 ;
-(CGRect)_visibleCenteringRect;
-(MKAnnotationView *)calloutAnnotationView;
-(MKPinAnnotationView *)bubblePin;
-(void)removeAnnotationViewsRotationAnimations;
-(void)_showBubbleForAnnotationView:(id)arg1 bounce:(BOOL)arg2 scrollToFit:(BOOL)arg3 avoid:(CGRect)arg4 ;
-(void)_showBubbleForAnnotationView:(id)arg1 bounce:(BOOL)arg2 scrollToFit:(BOOL)arg3 ;
-(void)setSuppressCallout:(BOOL)arg1 ;
-(void)_setSelectedAnnotationView:(id)arg1 bounce:(BOOL)arg2 pressed:(BOOL)arg3 scrollToFit:(BOOL)arg4 avoid:(CGRect)arg5 ;
-(void)_setSelectedAnnotationView:(id)arg1 bounce:(BOOL)arg2 pressed:(BOOL)arg3 scrollToFit:(BOOL)arg4 ;
-(void)deselectAnnotationView:(id)arg1 animated:(BOOL)arg2 ;
-(CLLocationCoordinate2D)coordinateForAnnotationView:(id)arg1 ;
-(CGPoint)pointForCoordinate:(CLLocationCoordinate2D)arg1 ;
-(void)updateAnnotationView:(id)arg1 ;
-(void)updateUserLocationView;
-(NSMutableArray *)annotationViews;
-(void)_findNextView:(id*)arg1 orientation:(int*)arg2 context:(id)arg3 ;
-(void)_updateOrientationOfViewsCorrect:(id)arg1 relative:(id)arg2 projectionView:(id)arg3 ;
-(void)_updateOrientationOfViewsFast:(id)arg1 relative:(id)arg2 projectionView:(id)arg3 ;
-(void)_updateOrientationOfViews:(id)arg1 relative:(id)arg2 projectionView:(id)arg3 ;
-(void)_updateOrientationOfViews:(id)arg1 ;
-(void)updateAnnotationLocationsDuringAnimation:(BOOL)arg1 ;
-(id)_annotationViewForSelectionAtPoint:(CGPoint)arg1 avoidCurrent:(BOOL)arg2 maxDistance:(double)arg3 ;
-(id)annotationViewForPoint:(CGPoint)arg1 ;
-(void)_liftForDragging:(id)arg1 mouseDownPoint:(CGPoint)arg2 ;
-(void)draggingTouchMovedToPoint:(CGPoint)arg1 edgeInsets:(UIEdgeInsets)arg2 ;
-(CGPoint)draggingAnnotationViewDropPoint;
-(CGPoint)draggingAnnotationViewDropPointForPoint:(CGPoint)arg1 ;
-(void)_dropDraggingAnnotationViewAnimated:(BOOL)arg1 ;
-(UIEdgeInsets)accessoryPadding;
-(BOOL)hasDroppingPins;
-(void)setUserLocationView:(MKAnnotationView *)arg1 ;
-(void)_dropPinsIfNeeded:(BOOL)arg1 ;
-(void)_willRemoveInternalAnnotationView:(id)arg1 ;
-(void)addAnnotationView:(id)arg1 allowAnimation:(BOOL)arg2 ;
-(void)finishAddingAnnotationViews;
-(void)removeAnnotationView:(id)arg1 ;
-(void)dropPinsIfNeeded;
-(void)selectAnnotationView:(id)arg1 animated:(BOOL)arg2 avoid:(CGRect)arg3 ;
-(SCD_Struct_MK21)currentComparisonContext;
-(unsigned long long)indexForAnnotationView:(id)arg1 ;
-(void)annotationViewDidChangeZIndex:(id)arg1 ;
-(void)annotationViewDidChangeCenterOffset:(id)arg1 ;
-(void)transitionFrom:(long long)arg1 to:(long long)arg2 duration:(double)arg3 ;
-(BOOL)suppressCallout;
@end
| 50.902098 | 176 | 0.819206 |
b413c249f16afc14d322be2a5698a9792af1b202 | 914 | kt | Kotlin | platform/script-debugger/backend/src/debugger/DeclarativeScope.kt | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | platform/script-debugger/backend/src/debugger/DeclarativeScope.kt | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | platform/script-debugger/backend/src/debugger/DeclarativeScope.kt | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.debugger
import org.jetbrains.concurrency.Promise
import org.jetbrains.concurrency.cancelledPromise
import org.jetbrains.debugger.values.ObjectValue
import org.jetbrains.debugger.values.ValueManager
abstract class DeclarativeScope<VALUE_MANAGER : ValueManager>(type: ScopeType, description: String? = null) : ScopeBase(type, description) {
protected abstract val childrenManager: VariablesHost<VALUE_MANAGER>
override val variablesHost: VariablesHost<*>
get() = childrenManager
protected fun loadScopeObjectProperties(value: ObjectValue): Promise<List<Variable>> {
if (childrenManager.valueManager.isObsolete) {
return cancelledPromise()
}
return value.properties.onSuccess { childrenManager.updateCacheStamp() }
}
} | 41.545455 | 140 | 0.793217 |
c52c86d6e8faf7f64aeb59ee9a7ebb0e6909bd34 | 471 | hpp | C++ | src/headers/System.Graphics.Image.hpp | qkmaxware/CppCore | 4a508ecfb768749d2c238d4292158a044c8bbaaa | [
"MIT"
] | null | null | null | src/headers/System.Graphics.Image.hpp | qkmaxware/CppCore | 4a508ecfb768749d2c238d4292158a044c8bbaaa | [
"MIT"
] | null | null | null | src/headers/System.Graphics.Image.hpp | qkmaxware/CppCore | 4a508ecfb768749d2c238d4292158a044c8bbaaa | [
"MIT"
] | null | null | null | #ifndef _SYSTEM_GRAPHICS_IMAGE_HPP
#define _SYSTEM_GRAPHICS_IMAGE_HPP
#include "System.Graphics.Colour.hpp"
#include <vector>
namespace System {
namespace Graphics {
class Image : public System::Object {
private:
std::vector<Colour> pixels;
uint width;
uint height;
public:
Image(uint width, uint height);
Colour& GetPixel(uint x, uint y);
uint GetWidth() const;
uint GetHeight() const;
};
}
}
#endif | 17.444444 | 41 | 0.653928 |
28bd7fd48944cb744b7a1e6c8e649a9954d8003c | 2,253 | cpp | C++ | wpilibc/src/main/native/cpp/smartdashboard/SendableBase.cpp | balupillai/allwpilib | 6992f5421f8222e1edf872a8788d88016ba46f2b | [
"BSD-3-Clause"
] | 61 | 2017-01-22T04:38:32.000Z | 2022-03-07T00:04:37.000Z | build/tmp/expandedArchives/wpilibc-cpp-2019.2.1-sources.zip_d2c10ca9fef4a09e287ef5192d19cdb5/smartdashboard/SendableBase.cpp | FRCTeam5458DigitalMinds/Axon | af571142de3f9d6589252c89537210015a1a26a0 | [
"BSD-3-Clause"
] | 3 | 2018-06-28T05:34:57.000Z | 2019-01-16T15:46:22.000Z | build/tmp/expandedArchives/wpilibc-cpp-2019.2.1-sources.zip_d2c10ca9fef4a09e287ef5192d19cdb5/smartdashboard/SendableBase.cpp | FRCTeam5458DigitalMinds/Axon | af571142de3f9d6589252c89537210015a1a26a0 | [
"BSD-3-Clause"
] | 17 | 2017-05-12T15:32:03.000Z | 2021-12-09T12:49:38.000Z | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "frc/smartdashboard/SendableBase.h"
#include <utility>
#include "frc/livewindow/LiveWindow.h"
using namespace frc;
SendableBase::SendableBase(bool addLiveWindow) {
if (addLiveWindow) LiveWindow::GetInstance()->Add(this);
}
SendableBase::~SendableBase() { LiveWindow::GetInstance()->Remove(this); }
SendableBase::SendableBase(SendableBase&& rhs) {
m_name = std::move(rhs.m_name);
m_subsystem = std::move(rhs.m_subsystem);
}
SendableBase& SendableBase::operator=(SendableBase&& rhs) {
Sendable::operator=(std::move(rhs));
m_name = std::move(rhs.m_name);
m_subsystem = std::move(rhs.m_subsystem);
return *this;
}
std::string SendableBase::GetName() const {
std::lock_guard<wpi::mutex> lock(m_mutex);
return m_name;
}
void SendableBase::SetName(const wpi::Twine& name) {
std::lock_guard<wpi::mutex> lock(m_mutex);
m_name = name.str();
}
std::string SendableBase::GetSubsystem() const {
std::lock_guard<wpi::mutex> lock(m_mutex);
return m_subsystem;
}
void SendableBase::SetSubsystem(const wpi::Twine& subsystem) {
std::lock_guard<wpi::mutex> lock(m_mutex);
m_subsystem = subsystem.str();
}
void SendableBase::AddChild(std::shared_ptr<Sendable> child) {
LiveWindow::GetInstance()->AddChild(this, child);
}
void SendableBase::AddChild(void* child) {
LiveWindow::GetInstance()->AddChild(this, child);
}
void SendableBase::SetName(const wpi::Twine& moduleType, int channel) {
SetName(moduleType + wpi::Twine('[') + wpi::Twine(channel) + wpi::Twine(']'));
}
void SendableBase::SetName(const wpi::Twine& moduleType, int moduleNumber,
int channel) {
SetName(moduleType + wpi::Twine('[') + wpi::Twine(moduleNumber) +
wpi::Twine(',') + wpi::Twine(channel) + wpi::Twine(']'));
}
| 30.863014 | 80 | 0.621394 |