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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
401b6defb0e38c30695e938e632796a3907305dc | 3,788 | py | Python | tarnow/switch.py | steffenschroeder/tarnow | f7699bdb1d0f7f6d3e9e57a07cc85b5f1918c911 | [
"MIT"
] | null | null | null | tarnow/switch.py | steffenschroeder/tarnow | f7699bdb1d0f7f6d3e9e57a07cc85b5f1918c911 | [
"MIT"
] | 4 | 2015-06-04T12:46:42.000Z | 2021-03-23T09:11:31.000Z | tarnow/switch.py | steffenschroeder/tarnow | f7699bdb1d0f7f6d3e9e57a07cc85b5f1918c911 | [
"MIT"
] | null | null | null | import os
import fcntl
import subprocess
import sys
import syslog as log
from . import config
class Switch(object):
def __str__(self):
return "Name: '%s', NextSkip: '%s', AllSkip: '%s'" % (
self.name,
str(self.next_skip),
str(self.all_skip),
)
@classmethod
def toggle_all(cls, status):
switches = config.switches
for switch in switches.keys():
s = Switch(switch)
if not s.dontIncludeInAllRuns:
s.toggle(status)
def __init__(self, name):
self.name = name
self.next_skip = Skip(name, "skip")
self.all_skip = Skip(name, "pernament")
self._initAlwaysOn()
def toggle(self, status):
if self.is_skip_all():
log.syslog("Skipping permanently " + self.name)
return
elif self.is_skip_next():
log.syslog("Skipping " + self.name)
# delete the file
self.dont_skip_next()
return
if self.name in config.switches:
self._change_status(status)
elif self.name == "all":
Switch.toggle_all(status)
else:
log.syslog(log.LOG_WARNING, "Called with unknown switch: " + self.name)
def _change_status(self, status):
lock = Lock()
try:
lock.acquire()
switch_to_change = config.switches.get(self.name)
unit_code = str(switch_to_change.get("unitcode"))
log.syslog("changing status of '%s' to '%s'" % (self.name, status))
subprocess.call(
[
str(config.executable),
str(config.areacode),
str(unit_code),
str(status),
]
)
finally:
lock.release()
def is_skip_next(self):
return self.next_skip.enabled()
def is_skip_all(self):
return self.all_skip.enabled()
def dont_skip_next(self):
self.next_skip.delete()
def dont_skip_all(self):
self.all_skip.delete()
def skip_next(self):
self.next_skip.create()
def skip_all(self):
self.all_skip.create()
def _initAlwaysOn(self):
self.dontIncludeInAllRuns = False
if self.name in config.switches.keys():
s = config.switches.get(self.name)
self.dontIncludeInAllRuns = s.get("dontIncludeInAllRuns", False)
class Skip(object):
def __str__(self):
return "Name: '%s', Type: '%s', enabled: ''%s" % (
self.name,
self.type,
self.enabled(),
)
def __init__(self, name, skiptype):
self.name = name
self.type = skiptype
self._generate_file_name()
def enabled(self):
return os.path.exists(self.skipfilename)
def create(self):
with open(self.skipfilename, "a"):
os.utime(self.skipfilename, None)
def delete(self):
if os.path.exists(self.skipfilename):
os.remove(self.skipfilename)
def _generate_file_name(self):
home = os.path.expanduser("~")
current_path = home + os.sep + ".tarnow"
if not os.path.exists(current_path):
os.makedirs(current_path)
self.skipfilename = current_path + os.sep + self.type + self.name + ".skip"
# Inspired by: http://blog.vmfarms.com/2011/03/cross-process-locking-and.html """
class Lock:
def __init__(self, filename="tarnow.tmp"):
self.filename = filename
self.handle = open(filename, "w")
def acquire(self):
fcntl.flock(self.handle, fcntl.LOCK_EX)
def release(self):
fcntl.flock(self.handle, fcntl.LOCK_UN)
def __del__(self):
self.handle.close()
| 27.449275 | 83 | 0.566262 |
4c3414cfcda790f2c5ecc674cdc3a39102506502 | 316 | php | PHP | resources/views/emails/order_success_email.blade.php | PhamHung2601/Duck | 408875d52163d49a42fbcb0649b807b73843f864 | [
"MIT"
] | null | null | null | resources/views/emails/order_success_email.blade.php | PhamHung2601/Duck | 408875d52163d49a42fbcb0649b807b73843f864 | [
"MIT"
] | 3 | 2021-03-10T13:04:08.000Z | 2022-02-19T00:02:27.000Z | resources/views/emails/order_success_email.blade.php | PhamHung2601/Duck | 408875d52163d49a42fbcb0649b807b73843f864 | [
"MIT"
] | null | null | null | @extends('emails.mail')
@section('before')
<div>
{!!\Helper::getStaticBlockContentById("email_order_success_before")!!}
</div>
@endsection
@section ('main')
@endsection
@section ('after')
<div>
{!!\Helper::getStaticBlockContentById("email_order_success_after")!!}
</div>
@endsection
| 21.066667 | 78 | 0.658228 |
878eb61c55729a555a40d2fb65f5bee5d9e0ef53 | 700 | html | HTML | lorem-angular-store/src/app/seller/seller.component.html | onborodin/lorem | 429faca03f67c5f413511b5b77ada6f2a06d3936 | [
"Artistic-2.0"
] | null | null | null | lorem-angular-store/src/app/seller/seller.component.html | onborodin/lorem | 429faca03f67c5f413511b5b77ada6f2a06d3936 | [
"Artistic-2.0"
] | null | null | null | lorem-angular-store/src/app/seller/seller.component.html | onborodin/lorem | 429faca03f67c5f413511b5b77ada6f2a06d3936 | [
"Artistic-2.0"
] | null | null | null | <div id="app">
<h5>{{ header }}</h5>
{{ message }}
<table>
<thead>
<tr>
<th>#</th>
<th>имя</th>
<th>рейтинг</th>
<th>состояние</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of dataRecords; let i = index">
<td>{{ i + 1 }}</td>
<td [ngStyle]="setStyle(i)">{{ item.name }}</td>
<td>{{ item.rate / 2}}</td>
<td>
<button (click)="upRate(item)" [ngClass]="setButton(item)">{{ item.stateDesc }}</button>
</td>
</tr>
</tbody>
</table>
</div> | 25.925926 | 108 | 0.351429 |
268f1b56bf96faf8c050dab477efa4f06d76675a | 5,282 | java | Java | src/toDoLy/TaskManager.java | parpinelopi/to-do-list | ab1794a6821170e3766250db0d06d75c7a657d1f | [
"OML"
] | null | null | null | src/toDoLy/TaskManager.java | parpinelopi/to-do-list | ab1794a6821170e3766250db0d06d75c7a657d1f | [
"OML"
] | null | null | null | src/toDoLy/TaskManager.java | parpinelopi/to-do-list | ab1794a6821170e3766250db0d06d75c7a657d1f | [
"OML"
] | null | null | null | package toDoLy;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
/**
* The class TaskManager contains most of the methods that are connected to the editing
* option of the main menu, such as sort and display tasks according to due date or project,
* change project name, title, due date, as well as the status. Additionally the delete task
* method.
*/
public class TaskManager {
private ArrayList<Task> tasks = new ArrayList<Task>();
private Interface start = new Interface();
/**
* The method is sorting the task according to date or project with numerical options
* using the Comparator class.
* class.
*/
public TaskManager() { //wrote it with capital letter
}
public static void sortDisplay(ArrayList<Task> list, String sortBy) {
if (sortBy.equals("1")) {
Collections.sort(list, new Comparator<Task>() {
@Override
public int compare(Task o1, Task o2) {
return o1.getDueDate().compareTo(o2.getDueDate());
}
});
}
if (sortBy.equals("2")) {
Collections.sort(list, new Comparator<Task>() {
@Override
public int compare(Task o1, Task o2) {
return o1.getProject().compareTo(o2.getProject());
}
});
}
for (Task task : list) {
System.out.println("Project :" + task.getProject() + " Title :" + task.getTitle() + " Due date:" + task.getDueDate() + " Status :" + (task.getStatus() ? "Done" : "Not done"));
}
}
/**
* The method editOption includes all of the editing options for the task by giving
* the task title. All of the fields can be edited, project, title, due date, status
* as well as removes the task completely. Switch statements are also used for this
* purpose
*
* @param list
* @throws IOException
*/
public void editOption(ArrayList<Task> list) throws IOException, ParseException {
System.out.println("Insert title of task to edit");
Scanner edit = new Scanner(System.in);
String taskTitle = edit.nextLine();
Task currentTask = new Task();
int i = 0;
for (Task task : list) {
if (task.getTitle().equals(taskTitle)) {
currentTask = task;
break;
}
i++;
}
System.out.println("Choose option to edit task");
System.out.println("1.Change Project name");
System.out.println("2.Change the due date");
System.out.println("3.Change the title");
System.out.println("4.Mark task as done");
System.out.println("5.Remove task");
System.out.println("0. Return to previous");
String taskOption = edit.nextLine();
switch (taskOption) {
case "0":
start.startScreen(list);
case "1":
System.out.println("Rename the project");
String f = edit.nextLine();
currentTask.changeProject(f);
break;
case "2":
System.out.println("Change due date");
currentTask.changeDueDate(start.insertDate());
break;
case "3":
System.out.println("Change the title");
String newTitle = edit.nextLine();
currentTask.changeTitle(newTitle);
break;
case "4":
currentTask.taskDone();
break;
case "5":
System.out.println("Enter title of the task to be removed");
String taskToRemove = edit.nextLine();
removeTask(taskToRemove, list);
default:
System.out.println("If you pressed wrong input, return with 0");
}
}
/**
* The method removeTask stores the chosen to remove task in a string and uses the
* Iterator interface to iterate through the ArrayList and uses .equals to find
* the title that was given to be removed and removes it.
*
* @param remTask stores the chosen according to title task to be removed
* @param list array list that stores the
*/
public void removeTask(String remTask, ArrayList<Task> list) {
String taskToRemove = remTask;
Iterator<Task> iterator = list.iterator();
while (iterator.hasNext()) {
Task task = iterator.next();
if (task.getTitle().equals(taskToRemove)) {
iterator.remove();
}
}
}
/**
* The method getList fetches the created ArrayList
*
* @return returns the tasks of the list.
*/
public ArrayList<Task> getList() {
return tasks;
}
/**
* The method countStatus counts the done and undone statuses of the objects of the ArrayList
*/
public void countStatus(ArrayList<Task> list) {
int undone;
int done = (int) list.stream().filter(Task::getStatus).count();
undone = list.size() - done;
System.out.println("You have " + undone + " undone and " + done + " done tasks");
}
} | 32.404908 | 190 | 0.565884 |
dda30b46aeda410c5b1566c0904c545aa3646ad9 | 2,677 | go | Go | main.go | Watson-Sei/sqlx-pg-sample | de113cfcda3270d8a08c4b5dc5f000011865bf84 | [
"MIT"
] | null | null | null | main.go | Watson-Sei/sqlx-pg-sample | de113cfcda3270d8a08c4b5dc5f000011865bf84 | [
"MIT"
] | null | null | null | main.go | Watson-Sei/sqlx-pg-sample | de113cfcda3270d8a08c4b5dc5f000011865bf84 | [
"MIT"
] | null | null | null | package main
import (
"fmt"
"log"
"time"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
)
type Tag struct {
ID int64 `db:"id"`
Name string `db:"name"`
CreatedAt time.Time `db:"created_at"`
}
type Article struct {
ID int64 `db:"id"`
Title string `db:"title"`
Body string `db:"body"`
UserId int64 `db:"user_id"`
CreatedAt time.Time `db:"created_at"`
}
type ArticleTag struct {
ID int64 `db:"id"`
ArticleId int64 `db:"article_id"`
TagId int64 `db:"tag_id"`
}
type ArticleResponse struct {
ID int64 `db:"id"`
Title string `db:"title"`
Body string `db:"body"`
UserId int64 `db:"user_id"`
CreatedAt time.Time `db:"created_at"`
Tags []Tag
}
func main() {
db, err := sqlx.Connect("postgres", "host=pg user=admin password=password dbname=sqlx_db sslmode=disable")
if err != nil {
log.Fatalln(err)
}
tagSlice := []string{"Curl", "HTTP", "HTTP2"}
tagIdSlice := []int64{}
for _, v := range tagSlice {
var tagId int64
err := db.QueryRowx(`INSERT INTO tags (name) VALUES ($1) on conflict (name) do UPDATE SET name=$1 RETURNING id`, v).Scan(&tagId)
if err != nil {
log.Panic(err)
}
tagIdSlice = append(tagIdSlice, tagId)
}
fmt.Println(tagIdSlice)
var createId int64
err = db.QueryRowx(`INSERT INTO articles (title, body, user_id) VALUES ($1, $2, $3) RETURNING id`, "Title1", "Body1", 1).Scan(&createId)
if err != nil {
log.Panic(err)
}
fmt.Println(createId)
for _, t := range tagIdSlice {
var articletagId int64
err = db.QueryRowx(`INSERT INTO articles_tags (article_id, tag_id) VALUES ($1, $2) RETURNING id`, createId, t).Scan(&articletagId)
if err != nil {
log.Panic(err)
}
fmt.Println(articletagId)
}
var articletag []ArticleTag
err = db.Select(&articletag, "SELECT * FROM articles_tags")
if err != nil {
log.Panic(err)
}
fmt.Println(articletag)
var articleDetail Article
err = db.Get(&articleDetail, "SELECT id, title, body, user_id, created_at FROM articles WHERE id = $1", createId)
if err != nil {
log.Panic(err)
}
fmt.Println(articleDetail)
articleTags := []Tag{}
err = db.Select(&articleTags, "SELECT tags.id, tags.name, tags.created_at FROM tags LEFT JOIN articles_tags ON tags.id = articles_tags.tag_id WHERE articles_tags.article_id = $1", createId)
if err != nil {
log.Panic(err)
}
fmt.Println(articleTags)
articleShow := &ArticleResponse{
ID: articleDetail.ID,
Title: articleDetail.Title,
Body: articleDetail.Body,
UserId: articleDetail.UserId,
CreatedAt: articleDetail.CreatedAt,
Tags: articleTags,
}
fmt.Println(articleShow)
}
| 23.901786 | 190 | 0.652223 |
53b71667a95333ea3a11f189100e171df6ad78ea | 1,349 | java | Java | leetcodetest/src/part_1/medium/sort/FrequencySort451.java | h03147/Algorithm-bro | 55471b8b905154d5e7ce16906a5665f53b7b96bb | [
"MIT"
] | 13 | 2021-03-09T14:12:55.000Z | 2021-12-23T06:27:17.000Z | leetcodetest/src/part_1/medium/sort/FrequencySort451.java | h03147/Algorithm-bro | 55471b8b905154d5e7ce16906a5665f53b7b96bb | [
"MIT"
] | 5 | 2021-01-31T11:52:17.000Z | 2021-04-08T15:26:20.000Z | leetcodetest/src/part_1/medium/sort/FrequencySort451.java | h03147/Algorithm-bro | 55471b8b905154d5e7ce16906a5665f53b7b96bb | [
"MIT"
] | 1 | 2021-11-30T16:27:27.000Z | 2021-11-30T16:27:27.000Z | package part_1.medium.sort;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class FrequencySort451 {
public static void main(String[] args) {
String s = "tree";
System.out.println(frequencySort(s));
}
public static String frequencySort(String s) {
// 创建一个hashmap把字符串中的每一个字符次数遍历出来
HashMap<Character, Integer> hashMap = new HashMap<>();
int size = s.length();
for(int i = 0; i < size; ++i) {
hashMap.put(s.charAt(i), hashMap.getOrDefault(s.charAt(i), 0) + 1);
}
// 为桶排序的桶开辟空间
List<Character>[] buckets = new ArrayList[size + 1];
for(char key : hashMap.keySet()) {
int value_count = hashMap.get(key);
if(buckets[value_count] == null) {
buckets[value_count] = new ArrayList<>();
}
buckets[value_count].add(key);
}
// 为结果集开辟空间
char[] result = new char[size];
// 按频次由高到低输出字符串
int i =0, k;
for(k = size; k > 0; --k) {
if(buckets[k] != null) {
for(char c : buckets[k]) {
for(int j = 0; j < k; ++j) {
result[i++] = c;
}
}
}
}
return new String(result);
}
}
| 26.45098 | 79 | 0.49444 |
1e5ad1e68dd2273fb9983be6c800e084d5c20ddc | 396 | kt | Kotlin | komapper-tx-jdbc/src/main/kotlin/org/komapper/tx/jdbc/TransactionSessionFactory.kt | komapper/komapper | 3c91b73c7e0c9d9002405577e939eee868f9054f | [
"Apache-2.0"
] | 60 | 2021-05-12T10:20:28.000Z | 2022-03-30T22:26:19.000Z | komapper-tx-jdbc/src/main/kotlin/org/komapper/tx/jdbc/TransactionSessionFactory.kt | komapper/komapper | 3c91b73c7e0c9d9002405577e939eee868f9054f | [
"Apache-2.0"
] | 25 | 2021-03-22T15:06:15.000Z | 2022-03-26T15:23:17.000Z | komapper-tx-jdbc/src/main/kotlin/org/komapper/tx/jdbc/TransactionSessionFactory.kt | komapper/komapper | 3c91b73c7e0c9d9002405577e939eee868f9054f | [
"Apache-2.0"
] | 1 | 2022-03-27T22:02:26.000Z | 2022-03-27T22:02:26.000Z | package org.komapper.tx.jdbc
import org.komapper.core.LoggerFacade
import org.komapper.jdbc.JdbcSession
import org.komapper.jdbc.spi.JdbcSessionFactory
import javax.sql.DataSource
class TransactionSessionFactory : JdbcSessionFactory {
override fun create(dataSource: DataSource, loggerFacade: LoggerFacade): JdbcSession {
return TransactionSession(dataSource, loggerFacade)
}
}
| 30.461538 | 90 | 0.810606 |
8697decff058b334f5c36aa50f98cc7b880d095e | 339 | go | Go | util/name.go | kokizzu/terracognita | 3cd454963de5ddff2b712adcb446581d75a84997 | [
"MIT"
] | 917 | 2019-06-04T20:07:53.000Z | 2022-03-31T11:06:11.000Z | util/name.go | kokizzu/terracognita | 3cd454963de5ddff2b712adcb446581d75a84997 | [
"MIT"
] | 154 | 2019-06-05T13:16:08.000Z | 2022-03-31T15:38:53.000Z | util/name.go | kokizzu/terracognita | 3cd454963de5ddff2b712adcb446581d75a84997 | [
"MIT"
] | 66 | 2019-06-24T09:44:19.000Z | 2022-03-28T03:18:17.000Z | package util
import (
"regexp"
"strings"
)
var invalidNameRegexp = regexp.MustCompile(`[^a-z0-9_]`)
// NormalizeName will convert the n into an low case alphanumeric value
// and the invalid characters will be replaced by '_'
func NormalizeName(n string) string {
return invalidNameRegexp.ReplaceAllString(strings.ToLower(n), "_")
}
| 22.6 | 71 | 0.752212 |
75c94ad9bd725fd29a5611f42cd6fab9016d7f0f | 3,394 | kt | Kotlin | kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/shading/LinearDepthShader.kt | fabmax/kool | 26b84eef86cf9ff6c61ad6e48d351c3e5e9ef9d7 | [
"Apache-2.0"
] | 83 | 2017-02-10T01:08:11.000Z | 2022-03-24T21:07:16.000Z | kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/shading/LinearDepthShader.kt | fabmax/kool | 26b84eef86cf9ff6c61ad6e48d351c3e5e9ef9d7 | [
"Apache-2.0"
] | 8 | 2020-06-26T05:50:28.000Z | 2022-02-11T21:32:12.000Z | kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/shading/LinearDepthShader.kt | fabmax/kool | 26b84eef86cf9ff6c61ad6e48d351c3e5e9ef9d7 | [
"Apache-2.0"
] | 7 | 2018-10-14T19:04:50.000Z | 2022-02-11T21:24:06.000Z | package de.fabmax.kool.pipeline.shading
import de.fabmax.kool.KoolContext
import de.fabmax.kool.pipeline.Attribute
import de.fabmax.kool.pipeline.BlendMode
import de.fabmax.kool.pipeline.Pipeline
import de.fabmax.kool.pipeline.shadermodel.*
import de.fabmax.kool.scene.Mesh
class LinearDepthShader(val cfg: DepthShaderConfig, model: ShaderModel = defaultDepthShaderModel(cfg)) : ModeledShader(model) {
val alphaMask = Texture2dInput("tAlphaMask", cfg.alphaMask)
override fun onPipelineSetup(builder: Pipeline.Builder, mesh: Mesh, ctx: KoolContext) {
builder.blendMode = BlendMode.DISABLED
builder.cullMethod = cfg.cullMethod
super.onPipelineSetup(builder, mesh, ctx)
}
override fun onPipelineCreated(pipeline: Pipeline, mesh: Mesh, ctx: KoolContext) {
alphaMask.connect(model)
super.onPipelineCreated(pipeline, mesh, ctx)
}
companion object {
fun defaultDepthShaderModel(cfg: DepthShaderConfig) = ShaderModel().apply {
var ifTexCoords: StageInterfaceNode? = null
vertexStage {
var mvpMat = premultipliedMvpNode().outMvpMat
if (cfg.isInstanced) {
mvpMat = multiplyNode(mvpMat, instanceAttrModelMat().output).output
}
if (cfg.isSkinned) {
val skinNd = skinTransformNode(attrJoints().output, attrWeights().output)
mvpMat = multiplyNode(mvpMat, skinNd.outJointMat).output
}
if (cfg.alphaMode is AlphaModeMask) {
ifTexCoords = stageInterfaceNode("ifTexCoords", attrTexCoords().output)
}
var localPos = attrPositions().output
val posMorphAttribs = cfg.morphAttributes.filter { it.name.startsWith(Attribute.POSITIONS.name) }
if (cfg.nMorphWeights > 0 && posMorphAttribs.isNotEmpty()) {
val morphWeights = morphWeightsNode(cfg.nMorphWeights)
posMorphAttribs.forEach { attrib ->
val weight = getMorphWeightNode(cfg.morphAttributes.indexOf(attrib), morphWeights)
val posDisplacement = multiplyNode(attributeNode(attrib).output, weight.outWeight)
localPos = addNode(localPos, posDisplacement.output).output
}
}
positionOutput = vec4TransformNode(localPos, mvpMat).outVec4
}
fragmentStage {
val alphaMode = cfg.alphaMode
if (alphaMode is AlphaModeMask) {
val color = texture2dSamplerNode(texture2dNode("tAlphaMask"), ifTexCoords!!.output).outColor
discardAlpha(splitNode(color, "a").output, constFloat(alphaMode.cutOff))
}
val linDepth = addNode(LinearDepthNode(stage))
colorOutput(linDepth.outColor)
}
}
}
private class LinearDepthNode(graph: ShaderGraph) : ShaderNode("linearDepth", graph) {
val outColor = ShaderNodeIoVar(ModelVar4f("linearDepth"), this)
override fun generateCode(generator: CodeGenerator) {
generator.appendMain("""
float d = gl_FragCoord.z / gl_FragCoord.w;
${outColor.declare()} = vec4(-d, 0.0, 0.0, 1.0);
""")
}
}
} | 44.077922 | 127 | 0.616382 |
cbbd38acbf4dc2b146b1bdb2e959bd16dac17901 | 727 | go | Go | AcceptedReason3Choice.go | fgrid/iso20022 | 1ec3952e565835b0bac076d4b574f88cc7bd0f74 | [
"MIT"
] | 18 | 2016-04-13T22:39:32.000Z | 2020-09-22T11:48:07.000Z | iso20022/AcceptedReason3Choice.go | fairxio/finance-messaging | 00ea27edb2cfa113132e8d7a1bdb321e544feed2 | [
"Apache-2.0"
] | 4 | 2016-04-29T21:44:36.000Z | 2016-06-06T21:20:04.000Z | AcceptedReason3Choice.go | fgrid/iso20022 | 1ec3952e565835b0bac076d4b574f88cc7bd0f74 | [
"MIT"
] | 11 | 2016-08-29T08:54:09.000Z | 2019-12-17T04:55:33.000Z | package iso20022
// Choice between a standard code or proprietary code to specify the reason why the instruction or cancellation request has a accepted status.
type AcceptedReason3Choice struct {
// Standard code to specify additional information about the processed instruction.
Code *AcknowledgementReason7Code `xml:"Cd"`
// Proprietary identification of additional information about the processed instruction.
Proprietary *GenericIdentification20 `xml:"Prtry"`
}
func (a *AcceptedReason3Choice) SetCode(value string) {
a.Code = (*AcknowledgementReason7Code)(&value)
}
func (a *AcceptedReason3Choice) AddProprietary() *GenericIdentification20 {
a.Proprietary = new(GenericIdentification20)
return a.Proprietary
}
| 34.619048 | 142 | 0.804677 |
a6de336547fa92b762642598515fcbb7759eee48 | 266 | sql | SQL | src/main/resources/db/migration/V20__sletter_feilopprettede_oppgave_makstid_påminnelser.sql | navikt/helse-spock | d8ad9f6338a0f949bc72752b6256ada0f7c83639 | [
"MIT"
] | null | null | null | src/main/resources/db/migration/V20__sletter_feilopprettede_oppgave_makstid_påminnelser.sql | navikt/helse-spock | d8ad9f6338a0f949bc72752b6256ada0f7c83639 | [
"MIT"
] | null | null | null | src/main/resources/db/migration/V20__sletter_feilopprettede_oppgave_makstid_påminnelser.sql | navikt/helse-spock | d8ad9f6338a0f949bc72752b6256ada0f7c83639 | [
"MIT"
] | null | null | null | DELETE
FROM oppgave_makstid_paminnelse
WHERE id in (
16217,16196,16197,16193,16216,16236,16198,16221,15853,16222,16240,16199,16241,16223,16200,16224,16242,
16202,16203,16227,16204,16229,15745,16206,16232,16037,16208,16244,16209,16213
); | 44.333333 | 115 | 0.733083 |
7024215e8ce4b0e009460d609244051799a7ebc2 | 1,565 | go | Go | pkg/runtimes/docker/util.go | lvuch/k3d | 7aa4a1f4b6c4d04f3826b4746ac620f8ec7b5fdc | [
"MIT"
] | null | null | null | pkg/runtimes/docker/util.go | lvuch/k3d | 7aa4a1f4b6c4d04f3826b4746ac620f8ec7b5fdc | [
"MIT"
] | null | null | null | pkg/runtimes/docker/util.go | lvuch/k3d | 7aa4a1f4b6c4d04f3826b4746ac620f8ec7b5fdc | [
"MIT"
] | null | null | null | /*
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package docker
import (
"fmt"
"github.com/docker/docker/api/types/filters"
k3d "github.com/rancher/k3d/pkg/types"
)
// GetDefaultObjectLabelsFilter returns docker type filters created from k3d labels
func GetDefaultObjectLabelsFilter(clusterName string) filters.Args {
filters := filters.NewArgs()
for key, value := range k3d.DefaultObjectLabels {
filters.Add("label", fmt.Sprintf("%s=%s", key, value))
}
filters.Add("label", fmt.Sprintf("k3d.cluster=%s", clusterName))
return filters
}
| 39.125 | 83 | 0.783387 |
d261069722cf62162ab5e4423b52d73a11ae3f13 | 39,307 | php | PHP | templates_c/3a9d41977047811bffc144f493e66334d50161dd.file.personIndex.tpl.php | hnliji1107/photo-blog | ebd3f62c721e740518ec3b7398c49e868e8bad90 | [
"MIT"
] | 1 | 2021-09-23T20:21:53.000Z | 2021-09-23T20:21:53.000Z | templates_c/3a9d41977047811bffc144f493e66334d50161dd.file.personIndex.tpl.php | hnliji1107/photo-blog | ebd3f62c721e740518ec3b7398c49e868e8bad90 | [
"MIT"
] | null | null | null | templates_c/3a9d41977047811bffc144f493e66334d50161dd.file.personIndex.tpl.php | hnliji1107/photo-blog | ebd3f62c721e740518ec3b7398c49e868e8bad90 | [
"MIT"
] | null | null | null | <?php /* Smarty version Smarty 3.1-RC1, created on 2012-05-03 13:28:36
compiled from ".\templates\personIndex.tpl" */ ?>
<?php /*%%SmartyHeaderCode:41534f954c62ef3cf8-16643535%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'file_dependency' =>
array (
'3a9d41977047811bffc144f493e66334d50161dd' =>
array (
0 => '.\\templates\\personIndex.tpl',
1 => 1336022913,
2 => 'file',
),
),
'nocache_hash' => '41534f954c62ef3cf8-16643535',
'function' =>
array (
),
'version' => 'Smarty 3.1-RC1',
'unifunc' => 'content_4f954c630fd73',
'variables' =>
array (
'isAuthor' => 0,
'authorName' => 0,
'photoComments' => 0,
'whoAddMe' => 0,
'userId' => 0,
'meAddWho' => 0,
'authorId' => 0,
'userAvatar' => 0,
'mePhotoInfoArr' => 0,
'friendInfoArr' => 0,
'otherUserInfoArr' => 0,
'photoNum' => 0,
'albumNum' => 0,
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_4f954c630fd73')) {function content_4f954c630fd73($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
<div id="content">
<div id="wrapper" class="clearfix">
<div class="f_r">
<div class="sonNav">
<ul class="xTabs clearfix">
<li><a href="javascript:;" class="current"><?php if ($_smarty_tpl->tpl_vars['isAuthor']->value){?>我<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['authorName']->value;?>
<?php }?>的动态</a></li>
<?php if ($_smarty_tpl->tpl_vars['isAuthor']->value){?>
<li><a href="javascript:;">朋友动态</a></li>
<li><a href="javascript:;">你可能感兴趣的人</a></li>
<?php }?>
</ul>
</div>
<!--Start 我的动态 -->
<ul class="Dynamic">
<?php if ($_smarty_tpl->tpl_vars['photoComments']->value||$_smarty_tpl->tpl_vars['whoAddMe']->value){?>
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['one']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['name'] = 'one';
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['photoComments']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total']);
?>
<li class="details clearfix">
<div class="ownerIco">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commenterId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commenterAvatar'];?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commenterId'];?>
" width="24" height="24" /></a>
</div>
<div class="ownerDynamic">
<div class="description clearfix">
<span class="otherInfo"><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commenterId'];?>
"><?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commenterName'];?>
</a>评论了<?php if ($_smarty_tpl->tpl_vars['isAuthor']->value){?>我<?php }else{ ?>他<?php }?>的照片:</span>
<span class="date"><?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commentTime'];?>
</span>
</div>
<ul class="photos clearfix">
<li><a href="photoBrowser.php?photoId=<?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['photoId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commentPhoto'];?>
" /></a></li>
<li class="photoDesc"><?php echo $_smarty_tpl->tpl_vars['photoComments']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['commentTxt'];?>
</li>
</ul>
</div>
</li>
<?php endfor; endif; ?>
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['one']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['name'] = 'one';
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['whoAddMe']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total']);
?>
<li class="details clearfix">
<div class="ownerIco">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoAvatar'];?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoId'];?>
" width="24" height="24" /></a>
</div>
<div class="ownerDynamic">
<div class="description clearfix">
<span class="otherInfo"><?php if ($_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoId']==$_smarty_tpl->tpl_vars['userId']->value){?>你<?php }else{ ?><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoId'];?>
"><?php echo $_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoName'];?>
</a><?php }?>添加<?php if ($_smarty_tpl->tpl_vars['isAuthor']->value){?>我<?php }else{ ?>他<?php }?>为好友</span>
<span class="date"><?php echo $_smarty_tpl->tpl_vars['whoAddMe']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['addTime'];?>
</span>
</div>
</div>
</li>
<?php endfor; endif; ?>
<?php if (!$_smarty_tpl->tpl_vars['isAuthor']->value){?>
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['one']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['name'] = 'one';
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['meAddWho']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total']);
?>
<li class="details clearfix">
<div class="ownerIco">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['userAvatar']->value;?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
" width="24" height="24" /></a>
</div>
<div class="ownerDynamic">
<div class="description clearfix">
<span class="otherInfo">他添加<?php if ($_smarty_tpl->tpl_vars['meAddWho']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoId']==$_smarty_tpl->tpl_vars['userId']->value){?>你<?php }else{ ?><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['meAddWho']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoId'];?>
"><?php echo $_smarty_tpl->tpl_vars['meAddWho']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['whoName'];?>
</a><?php }?>为好友</span>
<span class="date"><?php echo $_smarty_tpl->tpl_vars['meAddWho']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['addTime'];?>
</span>
</div>
</div>
</li>
<?php endfor; endif; ?>
<?php if ($_smarty_tpl->tpl_vars['mePhotoInfoArr']->value){?>
<li class="details clearfix">
<div class="ownerIco">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['userAvatar']->value;?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
" width="24" height="24" /></a>
</div>
<div class="ownerDynamic">
<div class="description clearfix">
<span class="otherInfo">他上传了<?php echo count($_smarty_tpl->tpl_vars['mePhotoInfoArr']->value);?>
张照片:</span>
<span class="date"><?php echo $_smarty_tpl->tpl_vars['mePhotoInfoArr']->value[0]['uploadTime'];?>
</span>
</div>
<ul class="photos clearfix">
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['one']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['name'] = 'one';
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['mePhotoInfoArr']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total']);
?>
<?php if ($_smarty_tpl->getVariable('smarty')->value['section']['one']['iteration']<6){?>
<li><a href="photoBrowser.php?photoId=<?php echo $_smarty_tpl->tpl_vars['mePhotoInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['photoId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['mePhotoInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['photoName'];?>
" /></a></li>
<?php }?>
<?php endfor; endif; ?>
</ul>
</div>
</li>
<?php }?>
<?php }?>
<?php }else{ ?>
暂无最新动态
<?php }?>
</ul>
<!--End 我的动态 -->
<!--Start 朋友的动态 -->
<ul class="Dynamic" style="display:none;">
<?php if ($_smarty_tpl->tpl_vars['friendInfoArr']->value){?>
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['one']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['name'] = 'one';
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['friendInfoArr']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total']);
?>
<?php if ($_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendPhotoInfoArr']){?>
<li class="details clearfix">
<div class="ownerIco">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendAvatar'];?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendId'];?>
" width="24" height="24" /></a>
</div>
<div class="ownerDynamic">
<div class="description clearfix">
<span class="otherInfo"><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendId'];?>
"><?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendName'];?>
</a>上传了<?php echo count($_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendPhotoInfoArr']);?>
张照片:</span>
<span class="date"><?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['uploadTime'];?>
</span>
</div>
<ul class="photos clearfix">
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['some']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['name'] = 'some';
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendPhotoInfoArr']) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total']);
?>
<?php if ($_smarty_tpl->getVariable('smarty')->value['section']['some']['iteration']<6){?>
<li><a href="photoBrowser.php?photoId=<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendPhotoInfoArr'][$_smarty_tpl->getVariable('smarty')->value['section']['some']['index']]['photoId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendPhotoInfoArr'][$_smarty_tpl->getVariable('smarty')->value['section']['some']['index']]['photoName'];?>
" /></a></li>
<?php }?>
<?php endfor; endif; ?>
</ul>
</div>
</li>
<?php }?>
<?php if ($_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['meAddWho']){?>
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['some']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['name'] = 'some';
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['meAddWho']) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['some']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['some']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['some']['total']);
?>
<li class="details clearfix">
<div class="ownerIco">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendId'];?>
"><img src="<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendAvatar'];?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendId'];?>
" width="24" height="24" /></a>
</div>
<div class="ownerDynamic">
<div class="description clearfix">
<span class="otherInfo"><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendId'];?>
"><?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['friendName'];?>
</a>添加<?php if ($_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['meAddWho'][$_smarty_tpl->getVariable('smarty')->value['section']['some']['index']]['whoId']==$_smarty_tpl->tpl_vars['userId']->value){?>我<?php }else{ ?><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['meAddWho'][$_smarty_tpl->getVariable('smarty')->value['section']['some']['index']]['whoId'];?>
"><?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['meAddWho'][$_smarty_tpl->getVariable('smarty')->value['section']['some']['index']]['whoName'];?>
</a><?php }?>为好友</span>
<span class="date"><?php echo $_smarty_tpl->tpl_vars['friendInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['meAddWho'][$_smarty_tpl->getVariable('smarty')->value['section']['some']['index']]['addTime'];?>
</span>
</div>
</div>
</li>
<?php endfor; endif; ?>
<?php }?>
<?php endfor; endif; ?>
<?php }else{ ?>
暂无最新动态
<?php }?>
</ul>
<!--End 朋友的动态 -->
<!--Start 加朋友 -->
<ul class="Dynamic userList" style="display:none;">
<?php if ($_smarty_tpl->tpl_vars['otherUserInfoArr']->value){?>
<?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']['one']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['name'] = 'one';
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['otherUserInfoArr']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] == 0)
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show'] = false;
} else
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['show']):
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['first'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['one']['last'] = ($_smarty_tpl->tpl_vars['smarty']->value['section']['one']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['one']['total']);
?>
<li>
<div class="uavatar">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['otherUserInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['otherUserId'];?>
">
<img src="<?php echo $_smarty_tpl->tpl_vars['otherUserInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['otherUserAvatar'];?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['otherUserInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['otherUserId'];?>
" width="80" height="80" />
</a>
</div>
<div class="uname"><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['otherUserInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['otherUserId'];?>
"><?php echo $_smarty_tpl->tpl_vars['otherUserInfoArr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['one']['index']]['otherUserName'];?>
</a></div>
<div class="addFrBtn"><a href="javascript:;" class="btn">加为好友</a></div>
</li>
<?php endfor; endif; ?>
<?php }else{ ?>
暂无推荐好友
<?php }?>
</ul>
<!--End 加朋友 -->
</div>
<div class="f_l">
<div class="right">
<div class="owner clearfix">
<a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
" class="Ico"><img src="<?php echo $_smarty_tpl->tpl_vars['userAvatar']->value;?>
" authorId="<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
" width="48" height="48" /></a>
<div class="ownerInformation">
<h1 class="clearBottom"><?php if ($_smarty_tpl->tpl_vars['isAuthor']->value){?>你好,<?php }?><?php echo $_smarty_tpl->tpl_vars['authorName']->value;?>
</h1>
<ul class="ownerNav clearfix">
<li><a href="myPhotos.php?userId=<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['photoNum']->value;?>
张照片</a></li>
<li><a href="albumList.php?userId=<?php echo $_smarty_tpl->tpl_vars['authorId']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['albumNum']->value;?>
个相册</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/personIndex.js" type="text/javascript"></script>
<?php echo $_smarty_tpl->getSubTemplate ("footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
<?php }} ?> | 83.810235 | 540 | 0.630498 |
5086a32f03db2b08e5508d406424949ca50edc4e | 2,417 | swift | Swift | Ecommerce/Classes/50_Item3/Item3Layout.swift | mattdanielbrown/AppDesignKit | 24792338770da081ccd8e2957db72189373fbd7e | [
"MIT"
] | 224 | 2020-05-16T12:03:33.000Z | 2022-03-30T12:43:27.000Z | Ecommerce/Classes/50_Item3/Item3Layout.swift | kalpeshjethva18/AppDesignKit | 24792338770da081ccd8e2957db72189373fbd7e | [
"MIT"
] | 5 | 2020-06-06T12:49:06.000Z | 2020-10-24T06:49:44.000Z | Ecommerce/Classes/50_Item3/Item3Layout.swift | kalpeshjethva18/AppDesignKit | 24792338770da081ccd8e2957db72189373fbd7e | [
"MIT"
] | 64 | 2020-05-14T07:52:37.000Z | 2022-03-30T11:31:41.000Z | //
// Copyright (c) 2021 Related Code - https://relatedcode.com
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
//-----------------------------------------------------------------------------------------------------------------------------------------------
class Item3PagingCollectionViewLayout: UICollectionViewFlowLayout {
private var velocityThresholdPerPage: CGFloat = 2
private var numberOfItemsPerPage: CGFloat = 1
//-------------------------------------------------------------------------------------------------------------------------------------------
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard let collectionView = collectionView else { return proposedContentOffset }
let pageLength: CGFloat
let approxPage: CGFloat
let currentPage: CGFloat
let speed: CGFloat
if scrollDirection == .horizontal {
pageLength = (itemSize.width + minimumLineSpacing) * numberOfItemsPerPage
approxPage = collectionView.contentOffset.x / pageLength
speed = velocity.x
} else {
pageLength = (itemSize.height + minimumLineSpacing) * numberOfItemsPerPage
approxPage = collectionView.contentOffset.y / pageLength
speed = velocity.y
}
if speed < 0 {
currentPage = ceil(approxPage)
} else if speed > 0 {
currentPage = floor(approxPage)
} else {
currentPage = round(approxPage)
}
guard speed != 0 else {
if scrollDirection == .horizontal {
return CGPoint(x: currentPage * pageLength, y: 0)
} else {
return CGPoint(x: 0, y: currentPage * pageLength)
}
}
var nextPage: CGFloat = currentPage + (speed > 0 ? 1 : -1)
let increment = speed / velocityThresholdPerPage
nextPage += (speed < 0) ? ceil(increment) : floor(increment)
if scrollDirection == .horizontal {
return CGPoint(x: nextPage * pageLength, y: 0)
} else {
return CGPoint(x: 0, y: nextPage * pageLength)
}
}
}
| 35.028986 | 145 | 0.64336 |
d2e8954af1824c00f248de516e95a40f394fa9ce | 380 | php | PHP | src/Renderer/JsonRenderer.php | dealroadshow/k8s-framework | 185de91025b95549731fc1fddcdec12f4bd15586 | [
"MIT"
] | 2 | 2020-10-07T09:04:47.000Z | 2020-11-19T07:16:17.000Z | src/Renderer/JsonRenderer.php | dealroadshow/k8s-framework | 185de91025b95549731fc1fddcdec12f4bd15586 | [
"MIT"
] | null | null | null | src/Renderer/JsonRenderer.php | dealroadshow/k8s-framework | 185de91025b95549731fc1fddcdec12f4bd15586 | [
"MIT"
] | 1 | 2020-10-25T15:47:16.000Z | 2020-10-25T15:47:16.000Z | <?php
namespace Dealroadshow\K8S\Framework\Renderer;
class JsonRenderer extends AbstractRenderer
{
public function render(\JsonSerializable|array $object): string
{
return \json_encode($this->renderAsArray($object));
}
public function renderAsArray(\JsonSerializable|array $object): array
{
return $this->withoutNullValues($object);
}
}
| 22.352941 | 73 | 0.707895 |
e50cbc9666ecc5be9f350b1d70063d08c3f298e9 | 1,591 | ts | TypeScript | src/auth/token.service.ts | mikhail-create/backend-test | 382e335d07ae2f6ae5b47d342cbe23bff034478b | [
"MIT"
] | null | null | null | src/auth/token.service.ts | mikhail-create/backend-test | 382e335d07ae2f6ae5b47d342cbe23bff034478b | [
"MIT"
] | null | null | null | src/auth/token.service.ts | mikhail-create/backend-test | 382e335d07ae2f6ae5b47d342cbe23bff034478b | [
"MIT"
] | null | null | null | import { Injectable, UnauthorizedException } from "@nestjs/common";
import { JwtService } from "@nestjs/jwt";
import { UserTokenData } from "src/auth/dto/auth-response.dto";
@Injectable()
export class TokenService {
constructor(private jwtService: JwtService) {}
async generateAccessToken(payload: UserTokenData): Promise<string> {
return this.jwtService.sign(payload, {
secret: process.env.ACCESS_KEY,
expiresIn: '15m'
})
}
async generateRefreshToken(payload: UserTokenData): Promise<string> {
return this.jwtService.sign(payload, {
secret: process.env.REFRESH_KEY,
expiresIn: '30d'
})
}
async validateAccessToken(access: string): Promise<UserTokenData> {
try {
return this.jwtService.verify(access, { secret: process.env.ACCESS_KEY })
}
catch (error) {
throw new UnauthorizedException({message: "Access token expired"})
}
}
async validateRefreshToken(refresh: string): Promise<UserTokenData> {
try {
return this.jwtService.verify(refresh, { secret: process.env.REFRESH_KEY })
}
catch (error) {
throw new UnauthorizedException({message: "Refresh token expired"})
}
}
syncValidateAccessToken(access: string): UserTokenData {
try {
return this.jwtService.verify(access, { secret: process.env.ACCESS_KEY })
}
catch {
throw new UnauthorizedException({message: "Sync Access token expired"})
}
}
} | 33.145833 | 87 | 0.624764 |
9381d445deb08fea4d08220fdbc32b3c28830125 | 570 | rs | Rust | translation/src/locale/env.rs | marek-g/rust-translation | 5502fc5f8b3aff6b28c1d94cdb52f664206b4e48 | [
"Apache-2.0",
"MIT"
] | null | null | null | translation/src/locale/env.rs | marek-g/rust-translation | 5502fc5f8b3aff6b28c1d94cdb52f664206b4e48 | [
"Apache-2.0",
"MIT"
] | null | null | null | translation/src/locale/env.rs | marek-g/rust-translation | 5502fc5f8b3aff6b28c1d94cdb52f664206b4e48 | [
"Apache-2.0",
"MIT"
] | null | null | null | use crate::locale::Locale;
use std::env;
impl Locale {
pub fn current() -> Option<Self> {
if let Ok(lang) = env::var("LC_ALL") {
if !lang.is_empty() {
return Locale::from(&lang);
}
}
if let Ok(lang) = env::var("LC_MESSAGES") {
if !lang.is_empty() {
return Locale::from(&lang);
}
}
if let Ok(lang) = env::var("LANG") {
if !lang.is_empty() {
return Locale::from(&lang);
}
};
None
}
}
| 21.111111 | 51 | 0.419298 |
878feb14f33155202131c6eb1cc13354be8b3f77 | 3,231 | html | HTML | SDL/docs/html/sdlenablekeyrepeat.html | mourad1081/LaRevancheDesIndustriels | e70e4fc961fe9bbc6035d71da996e85952b3edfe | [
"FTL"
] | 37 | 2015-01-11T20:08:48.000Z | 2022-01-06T17:25:22.000Z | SDL/docs/html/sdlenablekeyrepeat.html | mourad1081/LaRevancheDesIndustriels | e70e4fc961fe9bbc6035d71da996e85952b3edfe | [
"FTL"
] | 4 | 2016-05-20T01:01:59.000Z | 2016-06-22T00:03:27.000Z | SDL/docs/html/sdlenablekeyrepeat.html | mourad1081/LaRevancheDesIndustriels | e70e4fc961fe9bbc6035d71da996e85952b3edfe | [
"FTL"
] | 29 | 2020-03-05T15:15:24.000Z | 2021-07-21T07:05:00.000Z | <HTML
><HEAD
><TITLE
>SDL_EnableKeyRepeat</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Event Functions."
HREF="eventfunctions.html"><LINK
REL="PREVIOUS"
TITLE="SDL_EnableUNICODE"
HREF="sdlenableunicode.html"><LINK
REL="NEXT"
TITLE="SDL_GetMouseState"
HREF="sdlgetmousestate.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlenableunicode.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlgetmousestate.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLENABLEKEYREPEAT"
></A
>SDL_EnableKeyRepeat</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN5839"
></A
><H2
>Name</H2
>SDL_EnableKeyRepeat -- Set keyboard repeat rate.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN5842"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN5843"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_EnableKeyRepeat</B
></CODE
>(int delay, int interval);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN5849"
></A
><H2
>Description</H2
><P
>Enables or disables the keyboard repeat rate. <TT
CLASS="PARAMETER"
><I
>delay</I
></TT
> specifies how long the key must be pressed before it begins repeating, it then repeats at the speed specified by <TT
CLASS="PARAMETER"
><I
>interval</I
></TT
>. Both <TT
CLASS="PARAMETER"
><I
>delay</I
></TT
> and <TT
CLASS="PARAMETER"
><I
>interval</I
></TT
> are expressed in milliseconds.</P
><P
>Setting <TT
CLASS="PARAMETER"
><I
>delay</I
></TT
> to 0 disables key repeating completely. Good default values are <TT
CLASS="LITERAL"
>SDL_DEFAULT_REPEAT_DELAY</TT
> and <SPAN
CLASS="SYMBOL"
>SDL_DEFAULT_REPEAT_INTERVAL</SPAN
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN5860"
></A
><H2
>Return Value</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success and <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on failure.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlenableunicode.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlgetmousestate.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_EnableUNICODE</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="eventfunctions.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_GetMouseState</TD
></TR
></TABLE
></DIV
></BODY
></HTML
> | 13.57563 | 118 | 0.682761 |
ded1c2768e485f633f9f2a432e12ca368fa651ee | 3,986 | asm | Assembly | lala.asm | hajzer/asm-basic-examples | e8a32746ea5e20eb3c769d4a859337aa1dbc4f57 | [
"MIT"
] | null | null | null | lala.asm | hajzer/asm-basic-examples | e8a32746ea5e20eb3c769d4a859337aa1dbc4f57 | [
"MIT"
] | null | null | null | lala.asm | hajzer/asm-basic-examples | e8a32746ea5e20eb3c769d4a859337aa1dbc4f57 | [
"MIT"
] | null | null | null | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Nacitajte z klavesnice retazec znakov ukonceny znakom "novy riadok".
; Nech slovo je postupnost znakov medzi 2 znakmi "medzera".
; Urcte pocet slov obsahujucich len pismena malej abecedy.
; Pocet vytlacte sestnastkovo.
;
; Autor: LALA -> lala (at) linuxor (dot) sk
; Datum: 11.12.2002
;
; Subor: lala.asm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.model small
.stack 100
.data
pocet dw 0
priznak db 0
NL db 13,10,"$"
hlaska db "Pocet slov obsahujucich len pismena malej abecedy je: $"
hlaska2 db "Pocet vyjadreny ako sestnastkove cislo: $"
.code
Start:
mov ax,@data ; zistime kde su data a
mov ds,ax ; ulozime si ich do segmentoveho registra
reset:
mov bx,0 ; vynuluje bx ;; v bx je pocet znakov v slove
mov priznak,0 ; a priznak
citaj:
mov ah,1 ; sluzba nacita a zaroven vypise znak
int 21h
cmp al,' ' ; nacitany znak porovname zo znakom medzera
je space ; ak sa zhoduje skok na navestie space
cmp al,13 ; nacitany znak porovname zo znakom "novy riadok"
je last ; ak sa zhoduje skok na navestie last
cmp al,'a' ; porovnaj znak zo znakom 'a'
jb zle ; ak 'a' je vacsie ako al skok na navestie zle
cmp al,'z' ; porovnaj znak zo znakom 'z'
ja zle ; ak al je vacsie ako 'z' skok na navestie zle
cmp priznak,2 ; porovnaj priznak a 2
je citaj ; ak sa zhoduju skok na citaj
mov priznak,1 ; inac do priznaku daj 1
inc bx ; inkrementujeme bx ( pocet znakov v slove )
jmp citaj ; skok na citaj
zle:
mov priznak,2 ; do priznaku daj 2
inc bx ; inkrementujeme bx ( pocet znakov v slove )
jmp citaj ; skok na citaj
space:
cmp bx,0 ; porovname bx a 0
je reset ; ak sa zhoduju skok na reset
cmp priznak,1 ; porovnaj priznak a 1
ja reset ; ak je priznak vacsi ako 1 skok na citaj
inc pocet ; inac zvys pocet o 1
jmp reset ; skok na citaj
last:
cmp bx,0 ; porovname bx a 0
je vypis ; ak sa zhoduju skok na vypis
cmp priznak,1 ; porovnaj priznak a 1
ja vypis ; ak je priznak vacsi ako 1 skok na vypis
inc pocet ; zvys pocet o 1
vypis:
mov ah,09h ; sluzba vypisujuca retazec
mov dx,OFFSET NL ; do dx dame retazec ktory chceme vypisat
int 21h
mov ah,09h
mov dx,OFFSET hlaska
int 21h
mov ax,pocet ; do ax dame cislo ktore chceme vypisat
mov bx,10 ; do bx sustavu v ktorej chceme aby to vypisalo
call premen ; volanie funkcie ktora zabezpeci vypis
mov ah,09h
mov dx,OFFSET NL
int 21h
mov ah,09h
mov dx,OFFSET hlaska2
int 21h
mov ax,pocet
mov bx,16
call premen
koniec:
mov ax,4c00h ;exit do DOS-u
int 21h
; Procedura umoznuje vypis cisel v nasle-
; dovnych ciselnych sustavach 2,8,10,16.
;
; Vstup: register AX = cislo
; register BX = zaklad sustavy
;
; Vystup: cez INT 21h na obrazovku
premen proc near
push ax
xor cx, cx
wn0:
xor dx, dx
div bx
push dx
inc cx
test ax, ax
jnz wn0
wn2:
pop dx
or dl, '0'
cmp dl, '9'
jbe wn3
add dl, 7
wn3:
mov ah, 2
int 21h
loop wn2
pop ax
ret
premen endp
end Start
| 31.385827 | 79 | 0.50577 |
f061c0072bf5cafe06218d6dcad0cfd6cb82dd7c | 490 | js | JavaScript | src/reducers/reducer_hotel_details.js | vened/inna-react | 882feaa2cd1b9df7f3a3d14e7e12df327e81f2a3 | [
"MIT"
] | null | null | null | src/reducers/reducer_hotel_details.js | vened/inna-react | 882feaa2cd1b9df7f3a3d14e7e12df327e81f2a3 | [
"MIT"
] | null | null | null | src/reducers/reducer_hotel_details.js | vened/inna-react | 882feaa2cd1b9df7f3a3d14e7e12df327e81f2a3 | [
"MIT"
] | null | null | null | import { GET_HOTEL_DETAILS, GET_HOTEL_ROOMS } from '../actions/action_hotel_details';
import { processWithIsServer, multiProcessWithIsServer } from './helper';
export default function reducerHotelDetails(state = null, action = null) {
switch (action.type) {
case GET_HOTEL_DETAILS:
case GET_HOTEL_ROOMS:
var { data } = action;
return Object.assign({}, {
...data
});
default:
return state;
}
}
| 30.625 | 85 | 0.604082 |
5b83ebd25ba1cd3d1e06c4798a235379b53a7108 | 4,898 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1106.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1106.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1106.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x5edb, %r14
nop
add $25768, %r11
movw $0x6162, (%r14)
nop
inc %rbx
lea addresses_WC_ht+0x69a1, %rdx
nop
cmp %rsi, %rsi
movl $0x61626364, (%rdx)
xor $51211, %r12
lea addresses_normal_ht+0x1caf1, %rsi
lea addresses_UC_ht+0x5ca1, %rdi
nop
nop
nop
cmp %r11, %r11
mov $105, %rcx
rep movsw
nop
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r9
push %rax
push %rbp
push %rbx
push %rcx
push %rdx
// Store
lea addresses_normal+0xc81, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
add $21683, %rdx
movb $0x51, (%rbx)
nop
nop
nop
nop
nop
sub %rcx, %rcx
// Faulty Load
lea addresses_WC+0x1bca1, %r11
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov (%r11), %r9w
lea oracles, %rbx
and $0xff, %r9
shlq $12, %r9
mov (%rbx,%r9,1), %r9
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 45.775701 | 2,999 | 0.66129 |
f04ecbe5b92669ab08130a5ba429bece599f724e | 3,779 | js | JavaScript | srv/odata-client/sapb-1-service/InventoryPostingParams.js | gregorwolf/sap-business-one-odata-cap | f01d9c0488c2448ca2db633ff6fd02a80ff820fd | [
"Apache-2.0"
] | 1 | 2022-01-21T00:00:07.000Z | 2022-01-21T00:00:07.000Z | srv/odata-client/sapb-1-service/InventoryPostingParams.js | gregorwolf/sap-business-one-odata-cap | f01d9c0488c2448ca2db633ff6fd02a80ff820fd | [
"Apache-2.0"
] | null | null | null | srv/odata-client/sapb-1-service/InventoryPostingParams.js | gregorwolf/sap-business-one-odata-cap | f01d9c0488c2448ca2db633ff6fd02a80ff820fd | [
"Apache-2.0"
] | 1 | 2020-05-06T10:16:42.000Z | 2020-05-06T10:16:42.000Z | "use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.InventoryPostingParams = exports.InventoryPostingParamsField = exports.createInventoryPostingParams = void 0;
/*
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
var core_1 = require("@sap-cloud-sdk/core");
/**
* @deprecated Since v1.6.0. Use [[InventoryPostingParams.build]] instead.
*/
function createInventoryPostingParams(json) {
return InventoryPostingParams.build(json);
}
exports.createInventoryPostingParams = createInventoryPostingParams;
/**
* InventoryPostingParamsField
* @typeparam EntityT - Type of the entity the complex type field belongs to.
*/
var InventoryPostingParamsField = /** @class */ (function (_super) {
__extends(InventoryPostingParamsField, _super);
/**
* Creates an instance of InventoryPostingParamsField.
*
* @param fieldName - Actual name of the field as used in the OData request.
* @param fieldOf - Either the parent entity constructor of the parent complex type this field belongs to.
*/
function InventoryPostingParamsField(fieldName, fieldOf) {
var _this = _super.call(this, fieldName, fieldOf, InventoryPostingParams) || this;
/**
* Representation of the [[InventoryPostingParams.documentEntry]] property for query construction.
* Use to reference this property in query operations such as 'filter' in the fluent request API.
*/
_this.documentEntry = new core_1.ComplexTypeNumberPropertyField('DocumentEntry', _this, 'Edm.Int32');
/**
* Representation of the [[InventoryPostingParams.documentNumber]] property for query construction.
* Use to reference this property in query operations such as 'filter' in the fluent request API.
*/
_this.documentNumber = new core_1.ComplexTypeNumberPropertyField('DocumentNumber', _this, 'Edm.Int32');
return _this;
}
return InventoryPostingParamsField;
}(core_1.ComplexTypeField));
exports.InventoryPostingParamsField = InventoryPostingParamsField;
var InventoryPostingParams;
(function (InventoryPostingParams) {
/**
* Metadata information on all properties of the `InventoryPostingParams` complex type.
*/
InventoryPostingParams._propertyMetadata = [{
originalName: 'DocumentEntry',
name: 'documentEntry',
type: 'Edm.Int32',
isCollection: false
}, {
originalName: 'DocumentNumber',
name: 'documentNumber',
type: 'Edm.Int32',
isCollection: false
}];
/**
* @deprecated Since v1.25.0. Use `deserializeComplexTypeV2` or `deserializeComplexTypeV4` of the `@sap-cloud-sdk/core` package instead.
*/
function build(json) {
return core_1.deserializeComplexTypeV4(json, InventoryPostingParams);
}
InventoryPostingParams.build = build;
})(InventoryPostingParams = exports.InventoryPostingParams || (exports.InventoryPostingParams = {}));
//# sourceMappingURL=InventoryPostingParams.js.map | 45.53012 | 140 | 0.681662 |
6284ece6a18e81efc2c99a2953641b787c0fb1d7 | 44 | rs | Rust | Media/System/Shader/boundingBox.rs | xiaoyanziyaxiaoyanzi/facemapping | 5f4248203dc272d4216859ad0b20f88f1b2c8eca | [
"MIT"
] | 347 | 2016-01-29T10:43:39.000Z | 2022-03-26T01:21:40.000Z | Media/Castle/Shader/boundingBox.rs | GucciPrada/OcclusionCulling | 78fc358cc3e5feb0c9374f1254d993370b631258 | [
"Apache-2.0"
] | 3 | 2016-07-19T13:24:58.000Z | 2021-04-19T16:39:30.000Z | Media/Castle/Shader/boundingBox.rs | GucciPrada/OcclusionCulling | 78fc358cc3e5feb0c9374f1254d993370b631258 | [
"Apache-2.0"
] | 64 | 2016-02-23T16:31:24.000Z | 2022-03-17T23:08:29.000Z | [DepthStencilStateDX11]
DepthEnable = false
| 14.666667 | 23 | 0.840909 |
abad63046d051db1a9df970eb03d2b13f72a3789 | 499 | rb | Ruby | db/migrate/20210122043044_add_version_counts_to_statistics.rb | AnthonySuper/UntitledGameTracker | 3205d9f1d2608c5780cf3cd5c1db9837c7a77d8c | [
"MIT"
] | 84 | 2020-05-10T20:23:25.000Z | 2022-03-22T18:33:18.000Z | db/migrate/20210122043044_add_version_counts_to_statistics.rb | AnthonySuper/UntitledGameTracker | 3205d9f1d2608c5780cf3cd5c1db9837c7a77d8c | [
"MIT"
] | 291 | 2020-05-10T20:58:35.000Z | 2022-03-18T13:22:28.000Z | db/migrate/20210122043044_add_version_counts_to_statistics.rb | AnthonySuper/UntitledGameTracker | 3205d9f1d2608c5780cf3cd5c1db9837c7a77d8c | [
"MIT"
] | 34 | 2019-04-01T20:50:14.000Z | 2020-05-06T23:34:32.000Z | # typed: true
class AddVersionCountsToStatistics < ActiveRecord::Migration[6.1]
def change
add_column :statistics, :company_versions, :bigint, null: true
add_column :statistics, :game_versions, :bigint, null: true
add_column :statistics, :genre_versions, :bigint, null: true
add_column :statistics, :engine_versions, :bigint, null: true
add_column :statistics, :platform_versions, :bigint, null: true
add_column :statistics, :series_versions, :bigint, null: true
end
end
| 41.583333 | 67 | 0.749499 |
8767c42dc435f81e2ab8ad2cbb66923c9132f654 | 20,317 | html | HTML | lite-paper.html | tesla-safe/tesla-safe-web | fe0e33271367b95f9e2134855fb4762b4797b9a6 | [
"MIT"
] | 5 | 2021-07-13T10:06:04.000Z | 2021-07-16T18:15:02.000Z | lite-paper.html | tesla-safe/tesla-safe-web | fe0e33271367b95f9e2134855fb4762b4797b9a6 | [
"MIT"
] | 23 | 2021-05-21T17:46:31.000Z | 2022-01-02T17:03:10.000Z | lite-paper.html | tesla-safe/tesla-safe-web | fe0e33271367b95f9e2134855fb4762b4797b9a6 | [
"MIT"
] | 1 | 2021-09-01T21:45:40.000Z | 2021-09-01T21:45:40.000Z | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="TeslaSafe" />
<meta
property="og:title"
content="TeslaSafe - Put your investments on auto-pilot!"
/>
<meta
property="og:description"
content="TeslaSafe - Engineered to be the most deflationary token in the world."
/>
<meta property="og:type" content="website" />
<meta
property="og:image"
content="https://www.teslasafe.fi/img/tesla-safe-logo.png"
/>
<meta property="og:url" content="https://www.teslasafe.fi/" />
<title>TeslaSafe - Put your investments on auto-pilot!</title>
<link
rel="icon"
href="./assets/img/favicon.svg"
type="image/gif"
sizes="16x16"
/>
<!-- Bootstarp css -->
<link rel="stylesheet" href="./assets/css/bootstrap.css" />
<!-- Custom stylesheet -->
<link rel="stylesheet" href="./assets/css/style-2.css" />
<!-- AOS animation css link -->
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<!-- Custom js file -->
<script src="./assets/js/particulas.js" defer></script>
<script src="./assets/js/custom.js" defer></script>
<script
async
src="https://platform.twitter.com/widgets.js"
charset="utf-8"
></script>
<!-- Particles script -->
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
</head>
<body>
<!-- navbar starts here -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top">
<div class="site-title">
<img src="./assets/img/teslasafe-logo-v2.svg" alt="" height="65px" />
</div>
<a class="navbar-brand" href="index.html">
<span><img src="./assets/img/logo-circle.svg" alt="" /></span>
<img src="./assets/img/tesla-safe.svg" alt="" />
</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#collapsibleNavbar"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="faq.html">FAQ</a>
</li>
<li class="nav-item">
<a class="nav-link" href="lite-paper.html">Lite Paper</a>
</li>
<li class="nav-item">
<a class="nav-link" href="team.html">Team</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contest.html">Contest</a>
</li>
</ul>
</div>
</nav>
<!-- navbar ends here -->
<div id="particles-js"></div>
<!-- hero section starts here -->
<section class="page-hero-section">
<div class="container-fluid">
<div class="row">
<div
class="col-md-12 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<img src="./assets/img/diamond-icon.svg" alt="" />
<h1 class="page-hero-heading pt-5 pb-4">
TESLASAFE IS UNMATCHED IN DEFLATIONARY ACTION
</h1>
<p class="color-silver">
Here is a comparison vs other meme/reflection tokens
</p>
</div>
</div>
</div>
</section>
<!-- hero section ends here -->
<!-- Advantage section starts here -->
<section class="advantage-section">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1
class="page-hero-heading"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
TeslaSafe Advantage
</h1>
<p
class="color-silver my-1"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
TeslaSafe has the most aggressive hyper-deflationary model out of
any meme<br />
or reflection token ever created. HOLD.
</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table
class="table table-striped advantage-table my-5"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<tr>
<th class="table-col-1 table-feature-txt">FEATURES</th>
<th class="table-col-2 table-teslasafe-txt">TeslaSafe</th>
<th>Safemoon</th>
<th>Elongate</th>
<th>Rocket Moon</th>
</tr>
<tr>
<td class="table-col-1">Market capitalization</td>
<td class="table-col-2">7%</td>
<td>5%</td>
<td>?</td>
<td>5%</td>
</tr>
<tr>
<td class="table-col-1">Holder Rewards</td>
<td class="table-col-2">7%</td>
<td>5%</td>
<td>5%</td>
<td>5%</td>
</tr>
<tr>
<td class="table-col-1">Marketing</td>
<td class="table-col-2">10x</td>
<td>5x</td>
<td>2x</td>
<td>?</td>
</tr>
<tr>
<td class="table-col-1">Launch Burn</td>
<td class="table-col-2">20%</td>
<td>23%</td>
<td>0%</td>
<td>?</td>
</tr>
<tr>
<td class="table-col-1">Linear Burn</td>
<td class="table-col-2">19%</td>
<td>0%</td>
<td>1.6%</td>
<td>?</td>
</tr>
<tr>
<td class="table-col-1">Market capitalization</td>
<td class="table-col-2">Low</td>
<td>$4.25 Billion</td>
<td>$500 million</td>
<td>$40 million</td>
</tr>
</table>
</div>
</div>
</div>
</section>
<!-- Advantage section ends here -->
<!-- token nomics section starts here -->
<section class="mechanism-section">
<div class="container">
<div class="row">
<div
class="col-md-12 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<h1 class="page-hero-heading">HAVE A LOOK AT OUR LITE PAPER</h1>
<h5 class="color-silver">Helping you make smart investments</h5>
</div>
</div>
<div
class="lite-paper"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<div class="row">
<div
class="col-md-12 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<a class="" href="index.html">
<span><img src="./assets/img/logo-circle.svg" alt="" /></span>
<img src="./assets/img/tesla-safe.svg" alt="" class="pl-2" />
</a>
</div>
</div>
<div class="row my-5">
<div
class="col-6 my-auto"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<img
src="./assets/img/token-supply-icon.svg"
alt=""
class="float-right mr-3"
/>
</div>
<div
class="col-6"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<h6 class="color-white"><b>Token supply</b></h6>
<p class="mb-0 color-silver">1% Team Expenses</p>
<p class="mb-0 color-silver">39% Daily burn</p>
<p class="mb-0 color-silver">60% Community supply</p>
</div>
</div>
<div class="row my-5">
<div
class="col-md-12 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<p class="color-silver">
Automatic LP is the auto-pilot that TeslaSafe deploys. The
function<br />
creates strong buy pressure as we are increasing TeslaSafe’s
overall token<br />
LP value. As the token LP increases the price stability mirrors
this function<br />
with buy pressure as well as reduction of supply.
</p>
</div>
</div>
<div class="row my-5">
<div
class="col-6"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<img
src="./assets/img/rocket-icon.svg"
alt=""
class="float-right mr-3"
/>
</div>
<div
class="col-6"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<h6 class="color-white">
<b
>Team will burn tokens in team<br />
wallets 2-4X every single day
</b>
</h6>
<p class="color-silver">
Our primary objectives is to create hyper<br />
buy pressure on the token that you<br />
invest in. By burning tokens 2-4 times per<br />
day, the hyperdeflationary loop<br />
commences. On top of that, we continue<br />
to lock the LP multiple times a day as<br />
well.
</p>
</div>
</div>
<div class="row lite-section-line">
<div
class="col-md-4 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<p class="color-white pt-4">Transaction Tax</p>
<img src="./assets/img/completion-img-1.svg" alt="" />
<p class="color-silver pt-2">Creates price floor</p>
</div>
<div
class="col-md-4 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<p class="color-white pt-4">Reflection to holders</p>
<img src="./assets/img/completion-img-2.svg" alt="" />
<p class="color-silver pt-2">Creates incentive to hold</p>
</div>
<div
class="col-md-4 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<p class="color-white">
Automatically added<br />
to liquidity pool
</p>
<img src="./assets/img/completion-img-3.svg" alt="" />
<p class="color-silver pt-2">
50/50 split used for<br />
continued marketing and<br />
project development
</p>
</div>
</div>
<div class="row pt-5">
<div
class="col-md-4 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<img
src="./assets/img/fire.svg"
alt=""
height="50px"
width="50px"
/>
<p class="color-silver pt-2">
Token burn continue to add<br />
to the compounding effect<br />
of our hyperdeflationary<br />
model
</p>
</div>
<div
class="col-md-4 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<img
src="./assets/img/diamond-icon.svg"
alt=""
height="50px"
width="50px"
/>
<p class="color-silver pt-2">
Static rewards allow to alleviate<br />
downward swell pressure<br />
caused by early buyers selling<br />
their tokens.
</p>
</div>
<div
class="col-md-4 text-center"
data-aos="zoom-in"
data-aos-duration="3000"
data-aos-once="ture"
>
<img
src="./assets/img/dzone.svg"
alt=""
height="50px"
width="50px"
/>
<p class="color-silver pt-2">
Automatic liquidity pool creates<br />
a lasting supply for those who<br />
wants to purchase the token<br />
and expanding to exchanges<br />
creates greater demand.
</p>
</div>
</div>
</div>
</div>
</section>
<!-- token nomics section ends here -->
<!-- Footer section starts here -->
<footer>
<div class="container mt-5">
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<a href="https://tokens.fuzion.team/" target="_blank">
<img
src="./assets/img/fuzion-seal.svg"
alt="Fuzion seal Logo"
class="hover-magnify"
width="170px"
/>
</a>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<!-- social icons starts here -->
<ul class="social-icons d-flex justify-content-center my-5">
<li>
<a target="_blank" href="mailto:team@teslasafe.finance"
><img
src="./assets/icons/gmail.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://twitter.com/fuzionchain"
><img
src="./assets/icons/twitter.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://www.facebook.com/FuzionChain/"
><img
src="./assets/icons/facebook.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://www.tiktok.com/@fuzionchain"
><img
src="./assets/icons/tiktok.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://ricefarm.fi/"
><img
src="./assets/icons/farm.svg"
alt=""
width="27px"
height="30px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://www.instagram.com/fuzionchain/"
><img
src="./assets/icons/instagram.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://www.reddit.com/r/TeslaSafe"
><img
src="./assets/icons/reddit.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://t.me/fuzionchain"
><img
src="./assets/icons/telegram.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a target="_blank" href="https://discord.gg/24uAPzKYFu"
><img
src="./assets/icons/discord.svg"
alt=""
width="27px"
class="social-icon"
/></a>
</li>
<li>
<a onclick="addToken()" class="last-social-icon"
><img
src="./assets/img/metamask-icon.svg"
alt=""
width="27px"
/></a>
</li>
</ul>
<!-- social icons ends here -->
</div>
<div class="col-md-12 text-center">
<p class="footer-txt">
Bitcoin = Crypto = TeslaSafe = Hyperdeflationary
</p>
<ul class="justify-content-center footer-link my-4">
<li><a href="index.html">HOME</a></li>
<li>
<a target="_blank" href="https://teslasafe.ricefarm.fi/#/swap"
>INVEST</a
>
</li>
<li>
<a
target="_blank"
href="https://charts.bogged.finance/?token=0x3504de9e61FDFf2Fc70f5cC8a6D1Ee493434C1Aa"
>CHARTS</a
>
</li>
<li><a href="faq.html">FAQ </a></li>
<li><a href="lite-paper.html">LITE PAPER</a></li>
<li>
<a
target="_blank"
href="https://bscscan.com/token/0x3504de9e61fdff2fc70f5cc8a6d1ee493434c1aa"
>CONTRACT</a
>
</li>
<li><a href="contest.html">CONTEST</a></li>
</ul>
<p class="footer-txt">
Copyright © <span class="currentYear"></span> TeslaSafe - All Rights Reserved.
</p>
</div>
</div>
</div>
</footer>
<!-- Footer section ends here -->
<!-- All js files link -->
<!-- Bootstrap script cdn -->
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"
></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"
></script>
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
crossorigin="anonymous"
></script>
<!-- animated number counter script -->
<script src="./assets/js/multi-animated-counter.js" defer></script>
<!-- AOS animation script -->
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<script>
AOS.init();
</script>
<!-- Add token script -->
<script src="./assets/js/blockchain/addToken.js"></script>
</body>
</html>
| 34.031826 | 104 | 0.43914 |
aa23859bcac1db11ea7e6f8317ea56815e711907 | 2,431 | sql | SQL | internal/wordle/query/wordle_scores.sql | MrGrokas/DiscordWordle | 60713b65aaa46bc347b8e7eb1ff45b7140f1c95b | [
"MIT"
] | null | null | null | internal/wordle/query/wordle_scores.sql | MrGrokas/DiscordWordle | 60713b65aaa46bc347b8e7eb1ff45b7140f1c95b | [
"MIT"
] | null | null | null | internal/wordle/query/wordle_scores.sql | MrGrokas/DiscordWordle | 60713b65aaa46bc347b8e7eb1ff45b7140f1c95b | [
"MIT"
] | null | null | null | -- name: GetScoreHistoryByAccount :many
SELECT *
FROM wordle_scores
inner join nicknames nick on wordle_scores.discord_id = nick.discord_id
WHERE nick.discord_id = $1
and nick.server_id = $2
order by game_id;
-- name: ListScores :many
SELECT *
FROM wordle_scores
ORDER BY created_at;
-- name: CountScoresByDiscordId :one
SELECT count(*)
FROM wordle_scores
where discord_id = $1;
-- name: CreateScore :one
INSERT INTO wordle_scores (discord_id, game_id, guesses)
VALUES ($1, $2, $3)
RETURNING *;
-- name: UpdateScore :one
update wordle_scores
set guesses = $2
where discord_id = $1
and game_id = $3
returning *;
-- name: DeleteScoresForUser :exec
DELETE
FROM wordle_scores
WHERE discord_id = $1;
-- name: GetScoresByServerId :many
with max_game_week as (select max(game_id / 7) game_week
from wordle_scores
inner join nicknames n2 on wordle_scores.discord_id = n2.discord_id
where n2.server_id = $1
)
select n.nickname,
json_agg(guesses order by s.game_id) guesses_per_game,
json_agg((7 - s.guesses) ^ 2 order by s.game_id) points_per_game,
count(distinct game_id) games_count,
sum((7 - s.guesses) ^ 2) total
from wordle_scores s
inner join nicknames n on s.discord_id = n.discord_id
inner join max_game_week g on g.game_week = s.game_id / 7
where n.server_id = $1
group by n.nickname
order by sum((7 - s.guesses) ^ 2) desc;
-- name: GetScoresByServerIdPreviousWeek :many
with max_game_week as (select (max(game_id / 7)) - 1 game_week
from wordle_scores
inner join nicknames n2 on wordle_scores.discord_id = n2.discord_id
where n2.server_id = $1
)
select n.nickname,
json_agg(guesses order by s.game_id) guesses_per_game,
json_agg((7 - s.guesses) ^ 2 order by s.game_id) points_per_game,
count(distinct game_id) games_count,
sum((7 - s.guesses) ^ 2) total
from wordle_scores s
inner join nicknames n on s.discord_id = n.discord_id
inner join max_game_week g on g.game_week = (s.game_id / 7)
where n.server_id = $1
group by n.nickname
order by sum((7 - s.guesses) ^ 2) desc; | 34.728571 | 100 | 0.620321 |
5b3644158486723064c22f95f7eedb4008bd5a6b | 927 | h | C | System/Library/PrivateFrameworks/AvatarUI.framework/AVTCollectionViewLayout.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 12 | 2019-06-02T02:42:41.000Z | 2021-04-13T07:22:20.000Z | System/Library/PrivateFrameworks/AvatarUI.framework/AVTCollectionViewLayout.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/AvatarUI.framework/AVTCollectionViewLayout.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 3 | 2019-06-11T02:46:10.000Z | 2019-12-21T14:58:16.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Saturday, June 1, 2019 at 6:52:29 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/AvatarUI.framework/AvatarUI
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@protocol AVTCollectionViewLayout
@required
-(CGPoint*)centerForCenteringElementAtIndex:(long long)arg1 visibleBoundsSize:(CGSize)arg2 proposedOrigin:(CGPoint)arg3;
-(id)indexesForElementsInRect:(CGRect)arg1 visibleBounds:(CGRect)arg2 numberOfItems:(long long)arg3;
-(CGRect*)frameForElementAtIndex:(long long)arg1 visibleBounds:(CGRect)arg2;
-(CGSize*)contentSizeForVisibleBounds:(CGRect)arg1 numberOfItems:(long long)arg2;
-(CGRect*)initialFrameForAppearingElementAtOriginForVisibleBounds:(CGRect)arg1;
-(CGRect*)finalFrameForDisappearingElementAtOriginForVisibleBounds:(CGRect)arg1;
@end
| 44.142857 | 120 | 0.817691 |
bc9880727f92e722f88824320c27f380b792b38d | 1,035 | swift | Swift | z02sckhd_6wQgx_User/Classes/Goods/Controller/View/OnlinePayWayCell.swift | GoGoodGo/z02sckhd_6wQgx_User | daee6bfa5b014fb01786a61ee3244c540a3c2648 | [
"MIT"
] | null | null | null | z02sckhd_6wQgx_User/Classes/Goods/Controller/View/OnlinePayWayCell.swift | GoGoodGo/z02sckhd_6wQgx_User | daee6bfa5b014fb01786a61ee3244c540a3c2648 | [
"MIT"
] | null | null | null | z02sckhd_6wQgx_User/Classes/Goods/Controller/View/OnlinePayWayCell.swift | GoGoodGo/z02sckhd_6wQgx_User | daee6bfa5b014fb01786a61ee3244c540a3c2648 | [
"MIT"
] | null | null | null | //
// OnlinePayWayCell.swift
// TianMaUser
//
// Created by Healson on 2018/8/1.
// Copyright © 2018 YH. All rights reserved.
//
import UIKit
class OnlinePayWayCell: UITableViewCell {
@IBOutlet weak var aliPay: UIButton!
@IBOutlet weak var wxPay: UIButton!
var selectedBtn: UIButton?
var pay: ((_ type: String) -> Void)?
override func awakeFromNib() {
super.awakeFromNib()
selectedBtn = aliPay
}
@IBAction func action_aliPay(_ sender: UIButton) {
if let click = pay {
click("1")
}
}
@IBAction func action_wxPay(_ sender: UIButton) {
if let click = pay {
click("4")
}
}
// MARK: - Setter
override var frame: CGRect {
didSet {
let y: CGFloat = 10
var tempFrame = frame
tempFrame.origin.y += y
tempFrame.size.height -= y
super.frame = tempFrame
}
}
}
| 17.844828 | 54 | 0.514976 |
33980ab3812dd0b53ff6af68e7647198940bacae | 1,736 | kt | Kotlin | android/src/com/android/tools/idea/ui/resourcemanager/actions/AddFontAction.kt | phpc0de/idea-android | 79e20f027ca1d047b91aa7acd92fb71fa2968a09 | [
"Apache-2.0"
] | 831 | 2016-06-09T06:55:34.000Z | 2022-03-30T11:17:10.000Z | android/src/com/android/tools/idea/ui/resourcemanager/actions/AddFontAction.kt | phpc0de/idea-android | 79e20f027ca1d047b91aa7acd92fb71fa2968a09 | [
"Apache-2.0"
] | 19 | 2017-10-27T00:36:35.000Z | 2021-02-04T13:59:45.000Z | android/src/com/android/tools/idea/ui/resourcemanager/actions/AddFontAction.kt | phpc0de/idea-android | 79e20f027ca1d047b91aa7acd92fb71fa2968a09 | [
"Apache-2.0"
] | 210 | 2016-07-05T12:22:36.000Z | 2022-03-19T09:07:15.000Z | /*
* Copyright (C) 2019 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.ui.resourcemanager.actions
import com.android.resources.ResourceType
import com.android.tools.idea.editors.theme.ResolutionUtils
import com.android.tools.idea.fonts.MoreFontsDialog
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import org.jetbrains.android.facet.AndroidFacet
/**
* [AnAction] wrapper that calls the MoreFontsDialog to add new font resources.
*/
class AddFontAction(
private val facet: AndroidFacet,
private val createdResourceCallback: (String, ResourceType) -> Unit
): AnAction(MoreFontsDialog.ACTION_NAME, "Add font resources to project", null) {
override fun actionPerformed(e: AnActionEvent) {
val dialog = MoreFontsDialog(facet, null, false)
if (dialog.showAndGet()) {
dialog.resultingFont?.let {
createdResourceCallback(
// This returns a font name as a resource url '@font/name', but we just need the name.
ResolutionUtils.getNameFromQualifiedName(ResolutionUtils.getQualifiedNameFromResourceUrl(it)),
ResourceType.FONT)
}
}
}
}
| 39.454545 | 104 | 0.753456 |
2a8979fc08b34a78d1d2f2a5620169d93fdc9a83 | 4,337 | java | Java | app/src/main/java/com/yahala/ImageLoader/loader/util/SingleThreadedLoader.java | grevity/Yahala-Messenger | a50501c20090947e1fcdc72c1955952e07b513f8 | [
"MIT"
] | 17 | 2016-05-19T01:31:59.000Z | 2020-08-19T10:30:22.000Z | app/src/main/java/com/yahala/ImageLoader/loader/util/SingleThreadedLoader.java | grevity/Yahala-Messenger | a50501c20090947e1fcdc72c1955952e07b513f8 | [
"MIT"
] | 1 | 2017-03-17T06:46:34.000Z | 2019-01-11T14:09:29.000Z | app/src/main/java/com/yahala/ImageLoader/loader/util/SingleThreadedLoader.java | wmhameed/Yahala-Messenger | a50501c20090947e1fcdc72c1955952e07b513f8 | [
"MIT"
] | 15 | 2016-05-19T01:32:00.000Z | 2020-09-28T08:22:50.000Z | /**
* Copyright 2012 Novoda Ltd
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.yahala.ImageLoader.loader.util;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.util.Log;
import com.yahala.ImageLoader.exception.ImageNotFoundException;
import com.yahala.ImageLoader.model.ImageWrapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public abstract class SingleThreadedLoader {
private static final String TAG = "ImageLoader";
private BitmapLoader thread = new BitmapLoader();
private Stack<ImageWrapper> stack = new Stack<ImageWrapper>();
private List<String> notFoundImages = new ArrayList<String>();
public void push(ImageWrapper image) {
if (TextUtils.isEmpty(image.getUrl())) {
return;
}
pushOnStack(image);
startThread();
}
public int size() {
synchronized (stack) {
return stack.size();
}
}
public ImageWrapper pop() {
synchronized (stack) {
try {
return stack.pop();
} catch (Exception e) {
return null;
}
}
}
protected abstract Bitmap loadMissingBitmap(ImageWrapper iw);
protected abstract void onBitmapLoaded(ImageWrapper iw, Bitmap bmp);
private void clean(ImageWrapper p) {
synchronized (stack) {
for (int j = 0; j < stack.size(); j++) {
if (stack.get(j).getUrl() != null
&& stack.get(j).getUrl().equals(p.getUrl())) {
stack.remove(j);
j--;
}
}
}
}
private void pushOnStack(ImageWrapper p) {
synchronized (stack) {
stack.push(p);
}
}
private class BitmapLoader extends Thread {
boolean isWaiting = false;
public BitmapLoader() {
setPriority(Thread.NORM_PRIORITY - 1);
}
@Override
public void run() {
while (true) {
pauseThreadIfnecessary();
ImageWrapper image = pop();
if (image != null) {
loadAndShowImage(image);
}
}
}
private void pauseThreadIfnecessary() {
if (size() != 0) {
return;
}
synchronized (thread) {
try {
isWaiting = true;
wait();
} catch (Exception e) {
Log.v(TAG, "Pausing the thread error " + e.getMessage());
}
}
}
private void loadAndShowImage(ImageWrapper iw) {
try {
if (iw.isUrlChanged()) {
return;
}
Bitmap bmp = loadMissingBitmap(iw);
if (bmp == null) {
clean(iw);
onBitmapLoaded(iw, bmp);
return;
}
onBitmapLoaded(iw, bmp);
} catch (ImageNotFoundException inf) {
notFoundImages.add(iw.getUrl());
} catch (Throwable e) {
Log.e(TAG, "Throwable : " + e.getMessage(), e);
}
}
}
private void startThread() {
if (thread.getState() == Thread.State.NEW) {
thread.start();
return;
}
synchronized (thread) {
if (thread.isWaiting) {
try {
thread.isWaiting = false;
thread.notify();
} catch (Exception ie) {
Log.e(TAG, "Check and resume the thread " + ie.getMessage());
}
}
}
}
}
| 28.162338 | 81 | 0.517178 |
3a3debaadd52b90249d60a493853af0c96672fe8 | 378 | asm | Assembly | programs/oeis/335/A335115.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/335/A335115.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/335/A335115.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A335115: a(2*n) = 2*n - a(n), a(2*n+1) = 2*n + 1.
; 1,1,3,3,5,3,7,5,9,5,11,9,13,7,15,11,17,9,19,15,21,11,23,15,25,13,27,21,29,15,31,21,33,17,35,27,37,19,39,25,41,21,43,33,45,23,47,33,49,25,51,39,53,27,55,35,57,29,59,45,61,31,63,43,65,33,67,51,69,35,71,45,73,37,75
lpb $0,1
mov $2,$0
gcd $0,2
bin $0,2
sub $0,1
div $2,2
mul $0,$2
add $1,$2
lpe
mul $1,2
add $1,1
| 25.2 | 213 | 0.558201 |
50a65469446d5839d2878ace4ad8861aca598048 | 656 | swift | Swift | Movies/Movies/Library/Extensions/Int+Extensions.swift | paraisolorrayne/Movies | 5fc268fe8ba5dd497e890b1eacf9c6fe917b5ef0 | [
"MIT"
] | null | null | null | Movies/Movies/Library/Extensions/Int+Extensions.swift | paraisolorrayne/Movies | 5fc268fe8ba5dd497e890b1eacf9c6fe917b5ef0 | [
"MIT"
] | null | null | null | Movies/Movies/Library/Extensions/Int+Extensions.swift | paraisolorrayne/Movies | 5fc268fe8ba5dd497e890b1eacf9c6fe917b5ef0 | [
"MIT"
] | null | null | null | //
// Int+Extensions.swift
// Movies
//
// Created by Lorrayne Paraiso on 29/10/18.
// Copyright © 2018 Lorrayne Paraiso. All rights reserved.
//
import Foundation
extension Int {
func toUSCurrency() -> String {
let formatter = NumberFormatter()
formatter.locale = Locale(identifier: "en-US")
formatter.numberStyle = .currency
var retValue = ""
if let formattedTipAmount = formatter.string(from: self as NSNumber) {
retValue = formattedTipAmount
}
return retValue
}
func toRuntime() -> String {
return "\(self/60)h \((self)%60)m"
}
}
| 22.62069 | 78 | 0.589939 |
414cca72c6b4618c746bb3f03a0a750ce4c2d73a | 5,081 | h | C | usr/src/uts/common/io/chxge/com/ch_compat.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/uts/common/io/chxge/com/ch_compat.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/uts/common/io/chxge/com/ch_compat.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* ch_compat.h */
#ifndef CHELSIO_T1_COMPAT_H
#define CHELSIO_T1_COMPAT_H
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/* MAC and PHY link speeds */
enum { SPEED_10, SPEED_100, SPEED_1000, SPEED_10000 };
/* MAC and PHY link duplex */
enum { DUPLEX_HALF, DUPLEX_FULL };
/* Autonegotiation settings */
enum { AUTONEG_DISABLE, AUTONEG_ENABLE };
#ifndef MII_BMCR
/* Generic MII registers and register fields. */
#define MII_BMCR 0x00 /* Basic mode control register */
#define MII_BMSR 0x01 /* Basic mode status register */
#define MII_PHYSID1 0x02 /* PHYS ID 1 */
#define MII_PHYSID2 0x03 /* PHYS ID 2 */
#define MII_ADVERTISE 0x04 /* Advertisement control reg */
#define MII_LPA 0x05 /* Link partner ability reg */
/* Basic mode control register. */
#define BMCR_RESV 0x007f /* Unused... */
#define BMCR_CTST 0x0080 /* Collision test */
#define BMCR_FULLDPLX 0x0100 /* Full duplex */
#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */
#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */
#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
#define BMCR_RESET 0x8000 /* Reset the DP83840 */
/* Basic mode status register. */
#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
#define BMSR_JCD 0x0002 /* Jabber detected */
#define BMSR_LSTATUS 0x0004 /* Link status */
#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
#define BMSR_RFAULT 0x0010 /* Remote fault detected */
#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
#define BMSR_RESV 0x07c0 /* Unused... */
#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
/* Advertisement control register. */
#define ADVERTISE_SLCT 0x001f /* Selector bits */
#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
#define ADVERTISE_RESV 0x1c00 /* Unused... */
#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
#endif
/* MAC and PHY supported features */
#define SUPPORTED_10baseT_Half (1 << 0)
#define SUPPORTED_10baseT_Full (1 << 1)
#define SUPPORTED_100baseT_Half (1 << 2)
#define SUPPORTED_100baseT_Full (1 << 3)
#define SUPPORTED_1000baseT_Half (1 << 4)
#define SUPPORTED_1000baseT_Full (1 << 5)
#define SUPPORTED_10000baseT_Full (1 << 6)
#define SUPPORTED_Autoneg (1 << 7)
#define SUPPORTED_TP (1 << 8)
#define SUPPORTED_FIBRE (1 << 9)
#define SUPPORTED_PAUSE (1 << 10)
#define SUPPORTED_LOOPBACK (1 << 11)
/* Features advertised by PHY */
#define ADVERTISED_10baseT_Half (1 << 0)
#define ADVERTISED_10baseT_Full (1 << 1)
#define ADVERTISED_100baseT_Half (1 << 2)
#define ADVERTISED_100baseT_Full (1 << 3)
#define ADVERTISED_1000baseT_Half (1 << 4)
#define ADVERTISED_1000baseT_Full (1 << 5)
#define ADVERTISED_10000baseT_Full (1 << 6)
#define ADVERTISED_Autoneg (1 << 7)
#define ADVERTISED_PAUSE (1 << 10)
#define ADVERTISED_ASYM_PAUSE (1 << 12)
/* diagnostic message categories */
enum { LINK = 1, INTR = 2, HW = 4 };
/* diagnostic message levels */
/* enum { INFO, DEBUG }; */
#ifndef __devinit
#define __devinit
#endif
#ifndef CH_DEVICE
struct pci_device_id {
unsigned short devid;
unsigned short ssid;
unsigned short board_info_index;
};
#define CH_DEVICE_COMMON(devid, ssid, idx) { devid, ssid, idx }
#define CH_DEVICE(devid, ssid, idx) CH_DEVICE_COMMON(devid, ssid, idx)
#endif
#endif
| 35.78169 | 72 | 0.73273 |
44fb8a4a673fde87dacc8a6ba8911dfd4cbc7de3 | 5,541 | swift | Swift | Twitter/Twitter/DetailsViewController.swift | Donateaz/w-4-5--Submission | b82f67ee1bfc8c61682adead11a2d0b32e338bd5 | [
"Apache-2.0"
] | null | null | null | Twitter/Twitter/DetailsViewController.swift | Donateaz/w-4-5--Submission | b82f67ee1bfc8c61682adead11a2d0b32e338bd5 | [
"Apache-2.0"
] | 3 | 2016-03-23T19:09:50.000Z | 2016-03-25T04:20:24.000Z | Twitter/Twitter/DetailsViewController.swift | Donateaz/w-5--Submission | b82f67ee1bfc8c61682adead11a2d0b32e338bd5 | [
"Apache-2.0"
] | null | null | null | //
// DetailsViewController.swift
// Twitter
//
// Created by Donatea Zefi on 3/24/16.
// Copyright © 2016 Tejen. All rights reserved.
//
import UIKit
class DetailsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, TweetTableViewDelegate {
var rootTweetID: NSNumber?;
var tweet: Tweet?;
var closeNavBarOnDisappear = false;
var tweetChain = [Tweet]();
var chainIsPopulated = false {
didSet {
if(tweetChain.count > 1) {
self.title = "Conversation";
} else {
self.title = "Tweet";
}
}
};
var tweetComposedReply: Tweet?;
var lastIndexPath: NSIndexPath?;
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
tableView.delegate = self;
tableView.dataSource = self;
tableView.rowHeight = UITableViewAutomaticDimension;
tableView.estimatedRowHeight = 160.0;
rootTweetID = tweet!.TweetID;
NSNotificationCenter.defaultCenter().addObserverForName("DetailsTweetChainReady", object: nil, queue: NSOperationQueue.mainQueue()) { (NSNotification) -> Void in
while(self.tweet != nil) {
self.tweetChain.insert(self.tweet!, atIndex: 0);
self.tweet = self.tweet!.precedingTweet;
}
self.chainIsPopulated = true;
self.tableView.reloadData();
};
TwitterClient.sharedInstance.populatePreviousTweets(tweet!, completion: { () -> (Void) in
NSNotificationCenter.defaultCenter().postNotificationName("DetailsTweetChainReady", object: nil);
}
);
self.navigationController?.navigationBarHidden = false;
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated);
if(closeNavBarOnDisappear) {
self.navigationController?.navigationBarHidden = true;
}
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated);
tableViewScrollToBottom(true);
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(chainIsPopulated == true) {
return tweetChain.count;
}
return 0;
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellTweet = tweetChain[indexPath.row];
if(cellTweet.TweetID == rootTweetID) {
let cell = tableView.dequeueReusableCellWithIdentifier("TweetExpandedCell", forIndexPath: indexPath) as! TweetExtendedCell;
cell.indexPath = indexPath;
cell.tweet = cellTweet;
cell.delegate = self;
lastIndexPath = indexPath;
return cell;
} else {
let cell = tableView.dequeueReusableCellWithIdentifier("TweetCompactCell", forIndexPath: indexPath) as! TweetCompactCell;
cell.indexPath = indexPath;
cell.tweet = cellTweet;
cell.delegate = self;
return cell;
}
}
var reloadedIndexPaths = [Int]();
func reloadTableCellAtIndex(cell: UITableViewCell, indexPath: NSIndexPath) {
if(reloadedIndexPaths.indexOf(indexPath.row) == nil) {
reloadedIndexPaths.append(indexPath.row);
try! tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic);
}
}
func openProfile(userScreenname: NSString){
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle());
let vc = storyboard.instantiateViewControllerWithIdentifier("ProfileViewNavigationController") as! UINavigationController;
let pVc = vc.viewControllers.first as! ProfileViewController;
pVc.userScreenname = userScreenname;
self.presentViewController(vc, animated: true, completion: nil);
}
func openCompose(vc: UIViewController) {
self.presentViewController(vc, animated: true, completion: nil);
}
func tableViewScrollToBottom(animated: Bool) {
let delay = 0.1 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue(), {
let numberOfSections = self.tableView.numberOfSections
let numberOfRows = self.tableView.numberOfRowsInSection(numberOfSections-1)
if numberOfRows > 1 {
let indexPath = NSIndexPath(forRow: numberOfRows-1, inSection: (numberOfSections-1))
self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: animated);
self.tableView.cellForRowAtIndexPath(indexPath)?.layer.backgroundColor = UIColor(red: 1.0, green: 241/255.0, blue: 156/255.0, alpha: 1).CGColor;
UIView.animateWithDuration(2, animations: { () -> Void in
self.tableView.cellForRowAtIndexPath(indexPath)?.layer.backgroundColor = UIColor.clearColor().CGColor;
});
}
})
}
}
| 36.453947 | 169 | 0.628948 |
2a4e2903ee52b9d57ef92c51ce6d3b18be8d89f2 | 532 | java | Java | authz/src/main/java/com/monkeyk/os/service/ClientDetailsService.java | yindalei00/ydl-oauth2-shiro | 507524df3429dea38ea971788065523c74f2655b | [
"Apache-2.0"
] | 194 | 2017-01-21T09:39:32.000Z | 2021-11-29T09:03:31.000Z | authz/src/main/java/com/monkeyk/os/service/ClientDetailsService.java | yindalei00/ydl-oauth2-shiro | 507524df3429dea38ea971788065523c74f2655b | [
"Apache-2.0"
] | 5 | 2021-01-20T21:26:34.000Z | 2022-01-01T14:15:58.000Z | authz/src/main/java/com/monkeyk/os/service/ClientDetailsService.java | yindalei00/ydl-oauth2-shiro | 507524df3429dea38ea971788065523c74f2655b | [
"Apache-2.0"
] | 91 | 2017-02-06T03:53:55.000Z | 2022-03-09T05:40:52.000Z | package com.monkeyk.os.service;
import com.monkeyk.os.service.dto.ClientDetailsDto;
import com.monkeyk.os.service.dto.ClientDetailsFormDto;
import com.monkeyk.os.service.dto.ClientDetailsListDto;
/**
* 2016/6/8
*
* @author Shengzhao Li
*/
public interface ClientDetailsService {
ClientDetailsListDto loadClientDetailsListDto(String clientId);
ClientDetailsFormDto loadClientDetailsFormDto();
String saveClientDetails(ClientDetailsFormDto formDto);
ClientDetailsDto loadClientDetailsDto(String clientId);
} | 24.181818 | 67 | 0.800752 |
c7bd70c1c785911f2610df073e53b8f7d817fb37 | 8,206 | py | Python | scripts/control_input_manager.py | pjreed/rr_control_input_manager | 654b25132a4f120cc669fd2b441d51adeebc264f | [
"BSD-3-Clause"
] | null | null | null | scripts/control_input_manager.py | pjreed/rr_control_input_manager | 654b25132a4f120cc669fd2b441d51adeebc264f | [
"BSD-3-Clause"
] | null | null | null | scripts/control_input_manager.py | pjreed/rr_control_input_manager | 654b25132a4f120cc669fd2b441d51adeebc264f | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Author: Nick Fragale
# Description: This script manages cmd_vel from multiple sources so that they don't over-ride eachother, and so that soft E-stop can works from multiple sources.
import rospy
import time
from std_msgs.msg import Bool, String
from sensor_msgs.msg import Joy
from geometry_msgs.msg import Twist, TwistStamped
from actionlib_msgs.msg import GoalID
from copy import deepcopy
class CmdVelManager(object):
use_joystick = True
soft_estop = False
local_control_lock = False
remote_control_lock = False
command_timeout = 0.5
keyboard_control_input_request = Twist()
move_base_control_input_request = Twist()
auto_dock_control_input_request = TwistStamped()
fleet_manager_control_input_request = Twist()
joy_control_input_request = TwistStamped()
managed_control_input = TwistStamped()
seq = 0
def __init__(self):
# ROS Subscribers
self.keyboard_sub = rospy.Subscriber("/cmd_vel/keyboard", Twist, self.keyboard_cb)
self.joystick_sub = rospy.Subscriber("/cmd_vel/joystick", TwistStamped, self.joystick_cb)
self.move_base_sub = rospy.Subscriber("/cmd_vel/move_base", Twist, self.move_base_cb)
self.fleet_manager_sub = rospy.Subscriber("/cmd_vel/fleet_manager", Twist, self.fleet_manager_cb)
self.auto_dock_sub = rospy.Subscriber("/cmd_vel/auto_dock", TwistStamped, self.auto_dock_cb)
self.soft_estop_enable_sub = rospy.Subscriber("/soft_estop/enable", Bool, self.soft_estop_enable_cb)
self.soft_estop_reset_sub = rospy.Subscriber("/soft_estop/reset", Bool, self.soft_estop_reset_cb)
# ROS Publishers
self.managed_pub = rospy.Publisher('/cmd_vel/managed', TwistStamped, queue_size=1)
self.move_base_cancel = rospy.Publisher('/move_base/cancel', GoalID, queue_size=1)
self.active_controller_pub = rospy.Publisher('/rr_control_input_manager/active_controller', String, queue_size=1)
self.auto_dock_cancel = rospy.Publisher('/auto_dock/cancel', Bool, queue_size = 10)
self.last_move_base_command_time = rospy.Time.now()
self.last_auto_dock_command_time = rospy.Time.now()
self.last_fleet_manager_command_time = rospy.Time.now()
self.last_joy_command_time = rospy.Time.now()
self.last_keyboard_command_time = rospy.Time.now()
def control_input_pub(self, data):
my_managed_control_input = deepcopy(self.managed_control_input)
my_managed_control_input.header.seq = self.seq
my_managed_control_input.header.stamp = rospy.Time.now()
my_managed_control_input.header.frame_id = 'none'
my_managed_control_input.twist.linear.x=0.0
my_managed_control_input.twist.angular.y=0.0
my_managed_control_input.twist.angular.z=0.0
current_time = rospy.Time.now()
move_base_time_elapsed = current_time - self.last_move_base_command_time
auto_dock_time_elapsed = current_time - self.last_auto_dock_command_time
keyboard_time_elapsed = current_time - self.last_keyboard_command_time
fleet_manager_time_elapsed = current_time - self.last_fleet_manager_command_time
joy_time_elapsed = current_time - self.last_joy_command_time
if joy_time_elapsed.to_sec > 2:
self.lock_release_cb()
# Process non-human-local commands
if not self.local_control_lock:
# move_base requests (Priority 4)
if move_base_time_elapsed.to_sec() < self.command_timeout:
my_managed_control_input.twist = self.move_base_control_input_request
my_managed_control_input.header.frame_id = 'move_base'
# auto_dock requests (Lowest Priority 3)
if auto_dock_time_elapsed.to_sec() < self.command_timeout:
my_managed_control_input = self.auto_dock_control_input_request
my_managed_control_input.header.frame_id = 'auto_dock'
# fleet_manager requests (Priority 2)
if fleet_manager_time_elapsed.to_sec() < self.command_timeout:
my_managed_control_input.twist = self.fleet_manager_control_input_request
my_managed_control_input.header.frame_id = 'fleet_manager'
# keyboard priority 2
if keyboard_time_elapsed.to_sec() < self.command_timeout:
my_managed_control_input.twist = self.keyboard_control_input_request
my_managed_control_input.header.frame_id = 'keyboard'
# Process joystick requests (Highest Priority 1)
if joy_time_elapsed.to_sec() < self.command_timeout:
my_managed_control_input = self.joy_control_input_request
my_managed_control_input.header.frame_id = 'joystick'
# Check for estop
if self.soft_estop:
my_managed_control_input.header.frame_id = 'soft e-stopped'
my_managed_control_input.twist.linear.x=0
my_managed_control_input.twist.angular.y=0
my_managed_control_input.twist.angular.z=0
rospy.logwarn_throttle(60, "[CONTROL_INPUT_MANAGER_NODE] Soft Estop is still enabled which will prevent any motion")
self.managed_pub.publish(my_managed_control_input)
self.seq += 1
def move_base_cb(self, move_base_cmd_vel):
if (move_base_cmd_vel.linear.x, move_base_cmd_vel.angular.y, move_base_cmd_vel.angular.z) != (0,0,0):
self.last_move_base_command_time = rospy.Time.now()
self.move_base_control_input_request.linear.x = move_base_cmd_vel.linear.x
self.move_base_control_input_request.linear.y = move_base_cmd_vel.linear.y
self.move_base_control_input_request.angular.z = move_base_cmd_vel.angular.z * 1.4 ##Fudge factor, remove when switched to closed loop control on rr_openrover_basic
def auto_dock_cb(self, auto_dock_cmd_vel):
if (auto_dock_cmd_vel.twist.linear.x, auto_dock_cmd_vel.twist.angular.y, auto_dock_cmd_vel.twist.angular.z) != (0,0,0):
self.last_auto_dock_command_time = rospy.Time.now()
self.auto_dock_control_input_request = auto_dock_cmd_vel
def fleet_manager_cb(self, fleet_manager_cmd_vel):
self.last_fleet_manager_command_time = rospy.Time.now()
if (fleet_manager_cmd_vel.linear.x, fleet_manager_cmd_vel.angular.y, fleet_manager_cmd_vel.angular.z) != (0,0,0):
self.remote_control_lock = True
self.fleet_manager_control_input_request = fleet_manager_cmd_vel
def keyboard_cb(self, keyboard_cmd_vel):
# If a user starts to command the robot with a joystick, set local lock
if (keyboard_cmd_vel.linear.x, keyboard_cmd_vel.angular.y, keyboard_cmd_vel.angular.z) != (0,0,0):
self.last_keyboard_command_time = rospy.Time.now()
self.local_control_lock = True
self.keyboard_control_input_request = keyboard_cmd_vel
def joystick_cb(self, joy_cmd_vel):
# If a user starts to command the robot with a joystick, set local lock
if (joy_cmd_vel.twist.linear.x, joy_cmd_vel.twist.angular.y, joy_cmd_vel.twist.angular.z) != (0,0,0):
self.last_joy_command_time = joy_cmd_vel.header.stamp
self.local_control_lock = True
self.joy_control_input_request = joy_cmd_vel
def soft_estop_enable_cb(self, data):
if data.data == True:
self.soft_estop = True
cancel_msg=GoalID()
self.move_base_cancel.publish(cancel_msg)
stop_msg = Bool()
stop_msg.data = True
self.auto_dock_cancel.publish(stop_msg)
rospy.logwarn("[CONTROL_INPUT_MANAGER_NODE] Soft E-Stop Enabled")
def soft_estop_reset_cb(self, data):
if data.data == True:
self.soft_estop = False
rospy.logwarn("[CONTROL_INPUT_MANAGER_NODE] Soft E-Stop reset")
def lock_release_cb(self):
self.local_control_lock = False
self.remote_control_lock = False
if __name__ == '__main__':
rospy.init_node("control_input_manager_node")
my_manager = CmdVelManager()
cmd_managed_timer = rospy.Timer(rospy.Duration(0.1), my_manager.control_input_pub)
rospy.spin()
| 47.709302 | 176 | 0.715452 |
41fbe83e6a205de054d327432b00a6fb48165b0a | 29,247 | c | C | usr/src/uts/common/io/bufmod.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/uts/common/io/bufmod.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/uts/common/io/bufmod.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2018 Joyent, Inc.
*/
/*
* STREAMS Buffering module
*
* This streams module collects incoming messages from modules below
* it on the stream and buffers them up into a smaller number of
* aggregated messages. Its main purpose is to reduce overhead by
* cutting down on the number of read (or getmsg) calls its client
* user process makes.
* - only M_DATA is buffered.
* - multithreading assumes configured as D_MTQPAIR
* - packets are lost only if flag SB_NO_HEADER is clear and buffer
* allocation fails.
* - in order message transmission. This is enforced for messages other
* than high priority messages.
* - zero length messages on the read side are not passed up the
* stream but used internally for synchronization.
* FLAGS:
* - SB_NO_PROTO_CVT - no conversion of M_PROTO messages to M_DATA.
* (conversion is the default for backwards compatibility
* hence the negative logic).
* - SB_NO_HEADER - no headers in buffered data.
* (adding headers is the default for backwards compatibility
* hence the negative logic).
* - SB_DEFER_CHUNK - provides improved response time in question-answer
* applications. Buffering is not enabled until the second message
* is received on the read side within the sb_ticks interval.
* This option will often be used in combination with flag SB_SEND_ON_WRITE.
* - SB_SEND_ON_WRITE - a write message results in any pending buffered read
* data being immediately sent upstream.
* - SB_NO_DROPS - bufmod behaves transparently in flow control and propagates
* the blocked flow condition downstream. If this flag is clear (default)
* messages will be dropped if the upstream flow is blocked.
*/
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/debug.h>
#include <sys/stropts.h>
#include <sys/time.h>
#include <sys/stream.h>
#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/kmem.h>
#include <sys/strsun.h>
#include <sys/bufmod.h>
#include <sys/modctl.h>
#include <sys/isa_defs.h>
/*
* Per-Stream state information.
*
* If sb_ticks is negative, we don't deliver chunks until they're
* full. If it's zero, we deliver every packet as it arrives. (In
* this case we force sb_chunk to zero, to make the implementation
* easier.) Otherwise, sb_ticks gives the number of ticks in a
* buffering interval. The interval begins when the a read side data
* message is received and a timeout is not active. If sb_snap is
* zero, no truncation of the msg is done.
*/
struct sb {
queue_t *sb_rq; /* our rq */
mblk_t *sb_mp; /* partial chunk */
mblk_t *sb_head; /* pre-allocated space for the next header */
mblk_t *sb_tail; /* first mblk of last message appended */
uint_t sb_mlen; /* sb_mp length */
uint_t sb_mcount; /* input msg count in sb_mp */
uint_t sb_chunk; /* max chunk size */
clock_t sb_ticks; /* timeout interval */
timeout_id_t sb_timeoutid; /* qtimeout() id */
uint_t sb_drops; /* cumulative # discarded msgs */
uint_t sb_snap; /* snapshot length */
uint_t sb_flags; /* flags field */
uint_t sb_state; /* state variable */
};
/*
* Function prototypes.
*/
static int sbopen(queue_t *, dev_t *, int, int, cred_t *);
static int sbclose(queue_t *, int, cred_t *);
static int sbwput(queue_t *, mblk_t *);
static int sbrput(queue_t *, mblk_t *);
static int sbrsrv(queue_t *);
static void sbioctl(queue_t *, mblk_t *);
static void sbaddmsg(queue_t *, mblk_t *);
static void sbtick(void *);
static void sbclosechunk(struct sb *);
static void sbsendit(queue_t *, mblk_t *);
static struct module_info sb_minfo = {
21, /* mi_idnum */
"bufmod", /* mi_idname */
0, /* mi_minpsz */
INFPSZ, /* mi_maxpsz */
1, /* mi_hiwat */
0 /* mi_lowat */
};
static struct qinit sb_rinit = {
sbrput, /* qi_putp */
sbrsrv, /* qi_srvp */
sbopen, /* qi_qopen */
sbclose, /* qi_qclose */
NULL, /* qi_qadmin */
&sb_minfo, /* qi_minfo */
NULL /* qi_mstat */
};
static struct qinit sb_winit = {
sbwput, /* qi_putp */
NULL, /* qi_srvp */
NULL, /* qi_qopen */
NULL, /* qi_qclose */
NULL, /* qi_qadmin */
&sb_minfo, /* qi_minfo */
NULL /* qi_mstat */
};
static struct streamtab sb_info = {
&sb_rinit, /* st_rdinit */
&sb_winit, /* st_wrinit */
NULL, /* st_muxrinit */
NULL /* st_muxwinit */
};
/*
* This is the loadable module wrapper.
*/
static struct fmodsw fsw = {
"bufmod",
&sb_info,
D_MTQPAIR | D_MP
};
/*
* Module linkage information for the kernel.
*/
static struct modlstrmod modlstrmod = {
&mod_strmodops, "streams buffer mod", &fsw
};
static struct modlinkage modlinkage = {
MODREV_1, &modlstrmod, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
/* ARGSUSED */
static int
sbopen(queue_t *rq, dev_t *dev, int oflag, int sflag, cred_t *crp)
{
struct sb *sbp;
ASSERT(rq);
if (sflag != MODOPEN)
return (EINVAL);
if (rq->q_ptr)
return (0);
/*
* Allocate and initialize per-Stream structure.
*/
sbp = kmem_alloc(sizeof (struct sb), KM_SLEEP);
sbp->sb_rq = rq;
sbp->sb_ticks = -1;
sbp->sb_chunk = SB_DFLT_CHUNK;
sbp->sb_tail = sbp->sb_mp = sbp->sb_head = NULL;
sbp->sb_mlen = 0;
sbp->sb_mcount = 0;
sbp->sb_timeoutid = 0;
sbp->sb_drops = 0;
sbp->sb_snap = 0;
sbp->sb_flags = 0;
sbp->sb_state = 0;
rq->q_ptr = WR(rq)->q_ptr = sbp;
qprocson(rq);
return (0);
}
/* ARGSUSED1 */
static int
sbclose(queue_t *rq, int flag, cred_t *credp)
{
struct sb *sbp = (struct sb *)rq->q_ptr;
ASSERT(sbp);
qprocsoff(rq);
/*
* Cancel an outstanding timeout
*/
if (sbp->sb_timeoutid != 0) {
(void) quntimeout(rq, sbp->sb_timeoutid);
sbp->sb_timeoutid = 0;
}
/*
* Free the current chunk.
*/
if (sbp->sb_mp) {
freemsg(sbp->sb_mp);
sbp->sb_tail = sbp->sb_mp = sbp->sb_head = NULL;
sbp->sb_mlen = 0;
}
/*
* Free the per-Stream structure.
*/
kmem_free((caddr_t)sbp, sizeof (struct sb));
rq->q_ptr = WR(rq)->q_ptr = NULL;
return (0);
}
/*
* the correction factor is introduced to compensate for
* whatever assumptions the modules below have made about
* how much traffic is flowing through the stream and the fact
* that bufmod may be snipping messages with the sb_snap length.
*/
#define SNIT_HIWAT(msgsize, fudge) ((4 * msgsize * fudge) + 512)
#define SNIT_LOWAT(msgsize, fudge) ((2 * msgsize * fudge) + 256)
static void
sbioc(queue_t *wq, mblk_t *mp)
{
struct iocblk *iocp;
struct sb *sbp = (struct sb *)wq->q_ptr;
clock_t ticks;
mblk_t *mop;
iocp = (struct iocblk *)mp->b_rptr;
switch (iocp->ioc_cmd) {
case SBIOCGCHUNK:
case SBIOCGSNAP:
case SBIOCGFLAGS:
case SBIOCGTIME:
miocack(wq, mp, 0, 0);
return;
case SBIOCSTIME:
#ifdef _SYSCALL32_IMPL
if ((iocp->ioc_flag & IOC_MODELS) != IOC_NATIVE) {
struct timeval32 *t32;
t32 = (struct timeval32 *)mp->b_cont->b_rptr;
if (t32->tv_sec < 0 || t32->tv_usec < 0) {
miocnak(wq, mp, 0, EINVAL);
break;
}
ticks = TIMEVAL_TO_TICK(t32);
} else
#endif /* _SYSCALL32_IMPL */
{
struct timeval *tb;
tb = (struct timeval *)mp->b_cont->b_rptr;
if (tb->tv_sec < 0 || tb->tv_usec < 0) {
miocnak(wq, mp, 0, EINVAL);
break;
}
ticks = TIMEVAL_TO_TICK(tb);
}
sbp->sb_ticks = ticks;
if (ticks == 0)
sbp->sb_chunk = 0;
miocack(wq, mp, 0, 0);
sbclosechunk(sbp);
return;
case SBIOCSCHUNK:
/*
* set up hi/lo water marks on stream head read queue.
* unlikely to run out of resources. Fix at later date.
*/
if ((mop = allocb(sizeof (struct stroptions),
BPRI_MED)) != NULL) {
struct stroptions *sop;
uint_t chunk;
chunk = *(uint_t *)mp->b_cont->b_rptr;
mop->b_datap->db_type = M_SETOPTS;
mop->b_wptr += sizeof (struct stroptions);
sop = (struct stroptions *)mop->b_rptr;
sop->so_flags = SO_HIWAT | SO_LOWAT;
sop->so_hiwat = SNIT_HIWAT(chunk, 1);
sop->so_lowat = SNIT_LOWAT(chunk, 1);
qreply(wq, mop);
}
sbp->sb_chunk = *(uint_t *)mp->b_cont->b_rptr;
miocack(wq, mp, 0, 0);
sbclosechunk(sbp);
return;
case SBIOCSFLAGS:
sbp->sb_flags = *(uint_t *)mp->b_cont->b_rptr;
miocack(wq, mp, 0, 0);
return;
case SBIOCSSNAP:
/*
* if chunking dont worry about effects of
* snipping of message size on head flow control
* since it has a relatively small bearing on the
* data rate onto the streamn head.
*/
if (!sbp->sb_chunk) {
/*
* set up hi/lo water marks on stream head read queue.
* unlikely to run out of resources. Fix at later date.
*/
if ((mop = allocb(sizeof (struct stroptions),
BPRI_MED)) != NULL) {
struct stroptions *sop;
uint_t snap;
int fudge;
snap = *(uint_t *)mp->b_cont->b_rptr;
mop->b_datap->db_type = M_SETOPTS;
mop->b_wptr += sizeof (struct stroptions);
sop = (struct stroptions *)mop->b_rptr;
sop->so_flags = SO_HIWAT | SO_LOWAT;
fudge = snap <= 100 ? 4 :
snap <= 400 ? 2 :
1;
sop->so_hiwat = SNIT_HIWAT(snap, fudge);
sop->so_lowat = SNIT_LOWAT(snap, fudge);
qreply(wq, mop);
}
}
sbp->sb_snap = *(uint_t *)mp->b_cont->b_rptr;
miocack(wq, mp, 0, 0);
return;
default:
ASSERT(0);
return;
}
}
/*
* Write-side put procedure. Its main task is to detect ioctls
* for manipulating the buffering state and hand them to sbioctl.
* Other message types are passed on through.
*/
static int
sbwput(queue_t *wq, mblk_t *mp)
{
struct sb *sbp = (struct sb *)wq->q_ptr;
struct copyresp *resp;
if (sbp->sb_flags & SB_SEND_ON_WRITE)
sbclosechunk(sbp);
switch (mp->b_datap->db_type) {
case M_IOCTL:
sbioctl(wq, mp);
break;
case M_IOCDATA:
resp = (struct copyresp *)mp->b_rptr;
if (resp->cp_rval) {
/*
* Just free message on failure.
*/
freemsg(mp);
break;
}
switch (resp->cp_cmd) {
case SBIOCSTIME:
case SBIOCSCHUNK:
case SBIOCSFLAGS:
case SBIOCSSNAP:
case SBIOCGTIME:
case SBIOCGCHUNK:
case SBIOCGSNAP:
case SBIOCGFLAGS:
sbioc(wq, mp);
break;
default:
putnext(wq, mp);
break;
}
break;
default:
putnext(wq, mp);
break;
}
return (0);
}
/*
* Read-side put procedure. It's responsible for buffering up incoming
* messages and grouping them into aggregates according to the current
* buffering parameters.
*/
static int
sbrput(queue_t *rq, mblk_t *mp)
{
struct sb *sbp = (struct sb *)rq->q_ptr;
ASSERT(sbp);
switch (mp->b_datap->db_type) {
case M_PROTO:
if (sbp->sb_flags & SB_NO_PROTO_CVT) {
sbclosechunk(sbp);
sbsendit(rq, mp);
break;
} else {
/*
* Convert M_PROTO to M_DATA.
*/
mp->b_datap->db_type = M_DATA;
}
/* FALLTHRU */
case M_DATA:
if ((sbp->sb_flags & SB_DEFER_CHUNK) &&
!(sbp->sb_state & SB_FRCVD)) {
sbclosechunk(sbp);
sbsendit(rq, mp);
sbp->sb_state |= SB_FRCVD;
} else
sbaddmsg(rq, mp);
if ((sbp->sb_ticks > 0) && !(sbp->sb_timeoutid))
sbp->sb_timeoutid = qtimeout(sbp->sb_rq, sbtick,
sbp, sbp->sb_ticks);
break;
case M_FLUSH:
if (*mp->b_rptr & FLUSHR) {
/*
* Reset timeout, flush the chunk currently in
* progress, and start a new chunk.
*/
if (sbp->sb_timeoutid) {
(void) quntimeout(sbp->sb_rq,
sbp->sb_timeoutid);
sbp->sb_timeoutid = 0;
}
if (sbp->sb_mp) {
freemsg(sbp->sb_mp);
sbp->sb_tail = sbp->sb_mp = sbp->sb_head = NULL;
sbp->sb_mlen = 0;
sbp->sb_mcount = 0;
}
flushq(rq, FLUSHALL);
}
putnext(rq, mp);
break;
case M_CTL:
/*
* Zero-length M_CTL means our timeout() popped.
*/
if (MBLKL(mp) == 0) {
freemsg(mp);
sbclosechunk(sbp);
} else {
sbclosechunk(sbp);
sbsendit(rq, mp);
}
break;
default:
if (mp->b_datap->db_type <= QPCTL) {
sbclosechunk(sbp);
sbsendit(rq, mp);
} else {
/* Note: out of band */
putnext(rq, mp);
}
break;
}
return (0);
}
/*
* read service procedure.
*/
/* ARGSUSED */
static int
sbrsrv(queue_t *rq)
{
mblk_t *mp;
/*
* High priority messages shouldn't get here but if
* one does, jam it through to avoid infinite loop.
*/
while ((mp = getq(rq)) != NULL) {
if (!canputnext(rq) && (mp->b_datap->db_type <= QPCTL)) {
/* should only get here if SB_NO_SROPS */
(void) putbq(rq, mp);
return (0);
}
putnext(rq, mp);
}
return (0);
}
/*
* Handle write-side M_IOCTL messages.
*/
static void
sbioctl(queue_t *wq, mblk_t *mp)
{
struct sb *sbp = (struct sb *)wq->q_ptr;
struct iocblk *iocp = (struct iocblk *)mp->b_rptr;
struct timeval *t;
clock_t ticks;
mblk_t *mop;
int transparent = iocp->ioc_count;
mblk_t *datamp;
int error;
switch (iocp->ioc_cmd) {
case SBIOCSTIME:
if (iocp->ioc_count == TRANSPARENT) {
#ifdef _SYSCALL32_IMPL
if ((iocp->ioc_flag & IOC_MODELS) != IOC_NATIVE) {
mcopyin(mp, NULL, sizeof (struct timeval32),
NULL);
} else
#endif /* _SYSCALL32_IMPL */
{
mcopyin(mp, NULL, sizeof (*t), NULL);
}
qreply(wq, mp);
} else {
/*
* Verify argument length.
*/
#ifdef _SYSCALL32_IMPL
if ((iocp->ioc_flag & IOC_MODELS) != IOC_NATIVE) {
struct timeval32 *t32;
error = miocpullup(mp,
sizeof (struct timeval32));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
t32 = (struct timeval32 *)mp->b_cont->b_rptr;
if (t32->tv_sec < 0 || t32->tv_usec < 0) {
miocnak(wq, mp, 0, EINVAL);
break;
}
ticks = TIMEVAL_TO_TICK(t32);
} else
#endif /* _SYSCALL32_IMPL */
{
error = miocpullup(mp, sizeof (struct timeval));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
t = (struct timeval *)mp->b_cont->b_rptr;
if (t->tv_sec < 0 || t->tv_usec < 0) {
miocnak(wq, mp, 0, EINVAL);
break;
}
ticks = TIMEVAL_TO_TICK(t);
}
sbp->sb_ticks = ticks;
if (ticks == 0)
sbp->sb_chunk = 0;
miocack(wq, mp, 0, 0);
sbclosechunk(sbp);
}
break;
case SBIOCGTIME: {
struct timeval *t;
/*
* Verify argument length.
*/
if (transparent != TRANSPARENT) {
#ifdef _SYSCALL32_IMPL
if ((iocp->ioc_flag & IOC_MODELS) != IOC_NATIVE) {
error = miocpullup(mp,
sizeof (struct timeval32));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
} else
#endif /* _SYSCALL32_IMPL */
error = miocpullup(mp, sizeof (struct timeval));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
}
/*
* If infinite timeout, return range error
* for the ioctl.
*/
if (sbp->sb_ticks < 0) {
miocnak(wq, mp, 0, ERANGE);
break;
}
#ifdef _SYSCALL32_IMPL
if ((iocp->ioc_flag & IOC_MODELS) != IOC_NATIVE) {
struct timeval32 *t32;
if (transparent == TRANSPARENT) {
datamp = allocb(sizeof (*t32), BPRI_MED);
if (datamp == NULL) {
miocnak(wq, mp, 0, EAGAIN);
break;
}
mcopyout(mp, NULL, sizeof (*t32), NULL, datamp);
}
t32 = (struct timeval32 *)mp->b_cont->b_rptr;
TICK_TO_TIMEVAL32(sbp->sb_ticks, t32);
if (transparent == TRANSPARENT)
qreply(wq, mp);
else
miocack(wq, mp, sizeof (*t32), 0);
} else
#endif /* _SYSCALL32_IMPL */
{
if (transparent == TRANSPARENT) {
datamp = allocb(sizeof (*t), BPRI_MED);
if (datamp == NULL) {
miocnak(wq, mp, 0, EAGAIN);
break;
}
mcopyout(mp, NULL, sizeof (*t), NULL, datamp);
}
t = (struct timeval *)mp->b_cont->b_rptr;
TICK_TO_TIMEVAL(sbp->sb_ticks, t);
if (transparent == TRANSPARENT)
qreply(wq, mp);
else
miocack(wq, mp, sizeof (*t), 0);
}
break;
}
case SBIOCCTIME:
sbp->sb_ticks = -1;
miocack(wq, mp, 0, 0);
break;
case SBIOCSCHUNK:
if (iocp->ioc_count == TRANSPARENT) {
mcopyin(mp, NULL, sizeof (uint_t), NULL);
qreply(wq, mp);
} else {
/*
* Verify argument length.
*/
error = miocpullup(mp, sizeof (uint_t));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
/*
* set up hi/lo water marks on stream head read queue.
* unlikely to run out of resources. Fix at later date.
*/
if ((mop = allocb(sizeof (struct stroptions),
BPRI_MED)) != NULL) {
struct stroptions *sop;
uint_t chunk;
chunk = *(uint_t *)mp->b_cont->b_rptr;
mop->b_datap->db_type = M_SETOPTS;
mop->b_wptr += sizeof (struct stroptions);
sop = (struct stroptions *)mop->b_rptr;
sop->so_flags = SO_HIWAT | SO_LOWAT;
sop->so_hiwat = SNIT_HIWAT(chunk, 1);
sop->so_lowat = SNIT_LOWAT(chunk, 1);
qreply(wq, mop);
}
sbp->sb_chunk = *(uint_t *)mp->b_cont->b_rptr;
miocack(wq, mp, 0, 0);
sbclosechunk(sbp);
}
break;
case SBIOCGCHUNK:
/*
* Verify argument length.
*/
if (transparent != TRANSPARENT) {
error = miocpullup(mp, sizeof (uint_t));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
}
if (transparent == TRANSPARENT) {
datamp = allocb(sizeof (uint_t), BPRI_MED);
if (datamp == NULL) {
miocnak(wq, mp, 0, EAGAIN);
break;
}
mcopyout(mp, NULL, sizeof (uint_t), NULL, datamp);
}
*(uint_t *)mp->b_cont->b_rptr = sbp->sb_chunk;
if (transparent == TRANSPARENT)
qreply(wq, mp);
else
miocack(wq, mp, sizeof (uint_t), 0);
break;
case SBIOCSSNAP:
if (iocp->ioc_count == TRANSPARENT) {
mcopyin(mp, NULL, sizeof (uint_t), NULL);
qreply(wq, mp);
} else {
/*
* Verify argument length.
*/
error = miocpullup(mp, sizeof (uint_t));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
/*
* if chunking dont worry about effects of
* snipping of message size on head flow control
* since it has a relatively small bearing on the
* data rate onto the streamn head.
*/
if (!sbp->sb_chunk) {
/*
* set up hi/lo water marks on stream
* head read queue. unlikely to run out
* of resources. Fix at later date.
*/
if ((mop = allocb(sizeof (struct stroptions),
BPRI_MED)) != NULL) {
struct stroptions *sop;
uint_t snap;
int fudge;
snap = *(uint_t *)mp->b_cont->b_rptr;
mop->b_datap->db_type = M_SETOPTS;
mop->b_wptr += sizeof (*sop);
sop = (struct stroptions *)mop->b_rptr;
sop->so_flags = SO_HIWAT | SO_LOWAT;
fudge = (snap <= 100) ? 4 :
(snap <= 400) ? 2 : 1;
sop->so_hiwat = SNIT_HIWAT(snap, fudge);
sop->so_lowat = SNIT_LOWAT(snap, fudge);
qreply(wq, mop);
}
}
sbp->sb_snap = *(uint_t *)mp->b_cont->b_rptr;
miocack(wq, mp, 0, 0);
}
break;
case SBIOCGSNAP:
/*
* Verify argument length
*/
if (transparent != TRANSPARENT) {
error = miocpullup(mp, sizeof (uint_t));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
}
if (transparent == TRANSPARENT) {
datamp = allocb(sizeof (uint_t), BPRI_MED);
if (datamp == NULL) {
miocnak(wq, mp, 0, EAGAIN);
break;
}
mcopyout(mp, NULL, sizeof (uint_t), NULL, datamp);
}
*(uint_t *)mp->b_cont->b_rptr = sbp->sb_snap;
if (transparent == TRANSPARENT)
qreply(wq, mp);
else
miocack(wq, mp, sizeof (uint_t), 0);
break;
case SBIOCSFLAGS:
/*
* set the flags.
*/
if (iocp->ioc_count == TRANSPARENT) {
mcopyin(mp, NULL, sizeof (uint_t), NULL);
qreply(wq, mp);
} else {
error = miocpullup(mp, sizeof (uint_t));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
sbp->sb_flags = *(uint_t *)mp->b_cont->b_rptr;
miocack(wq, mp, 0, 0);
}
break;
case SBIOCGFLAGS:
/*
* Verify argument length
*/
if (transparent != TRANSPARENT) {
error = miocpullup(mp, sizeof (uint_t));
if (error != 0) {
miocnak(wq, mp, 0, error);
break;
}
}
if (transparent == TRANSPARENT) {
datamp = allocb(sizeof (uint_t), BPRI_MED);
if (datamp == NULL) {
miocnak(wq, mp, 0, EAGAIN);
break;
}
mcopyout(mp, NULL, sizeof (uint_t), NULL, datamp);
}
*(uint_t *)mp->b_cont->b_rptr = sbp->sb_flags;
if (transparent == TRANSPARENT)
qreply(wq, mp);
else
miocack(wq, mp, sizeof (uint_t), 0);
break;
default:
putnext(wq, mp);
break;
}
}
/*
* Given a length l, calculate the amount of extra storage
* required to round it up to the next multiple of the alignment a.
*/
#define RoundUpAmt(l, a) ((l) % (a) ? (a) - ((l) % (a)) : 0)
/*
* Calculate additional amount of space required for alignment.
*/
#define Align(l) RoundUpAmt(l, sizeof (ulong_t))
/*
* Smallest possible message size when headers are enabled.
* This is used to calculate whether a chunk is nearly full.
*/
#define SMALLEST_MESSAGE sizeof (struct sb_hdr) + _POINTER_ALIGNMENT
/*
* Process a read-side M_DATA message.
*
* If the currently accumulating chunk doesn't have enough room
* for the message, close off the chunk, pass it upward, and start
* a new one. Then add the message to the current chunk, taking
* account of the possibility that the message's size exceeds the
* chunk size.
*
* If headers are enabled add an sb_hdr header and trailing alignment padding.
*
* To optimise performance the total number of msgbs should be kept
* to a minimum. This is achieved by using any remaining space in message N
* for both its own padding as well as the header of message N+1 if possible.
* If there's insufficient space we allocate one message to hold this 'wrapper'.
* (there's likely to be space beyond message N, since allocb would have
* rounded up the required size to one of the dblk_sizes).
*
*/
static void
sbaddmsg(queue_t *rq, mblk_t *mp)
{
struct sb *sbp;
struct timeval t;
struct sb_hdr hp;
mblk_t *wrapper; /* padding for msg N, header for msg N+1 */
mblk_t *last; /* last mblk of current message */
size_t wrapperlen; /* length of header + padding */
size_t origlen; /* data length before truncation */
size_t pad; /* bytes required to align header */
sbp = (struct sb *)rq->q_ptr;
origlen = msgdsize(mp);
/*
* Truncate the message.
*/
if ((sbp->sb_snap > 0) && (origlen > sbp->sb_snap) &&
(adjmsg(mp, -(origlen - sbp->sb_snap)) == 1))
hp.sbh_totlen = hp.sbh_msglen = sbp->sb_snap;
else
hp.sbh_totlen = hp.sbh_msglen = origlen;
if (sbp->sb_flags & SB_NO_HEADER) {
/*
* Would the inclusion of this message overflow the current
* chunk? If so close the chunk off and start a new one.
*/
if ((hp.sbh_totlen + sbp->sb_mlen) > sbp->sb_chunk)
sbclosechunk(sbp);
/*
* First message too big for chunk - just send it up.
* This will always be true when we're not chunking.
*/
if (hp.sbh_totlen > sbp->sb_chunk) {
sbsendit(rq, mp);
return;
}
/*
* We now know that the msg will fit in the chunk.
* Link it onto the end of the chunk.
* Since linkb() walks the entire chain, we keep a pointer to
* the first mblk of the last msgb added and call linkb on that
* that last message, rather than performing the
* O(n) linkb() operation on the whole chain.
* sb_head isn't needed in this SB_NO_HEADER mode.
*/
if (sbp->sb_mp)
linkb(sbp->sb_tail, mp);
else
sbp->sb_mp = mp;
sbp->sb_tail = mp;
sbp->sb_mlen += hp.sbh_totlen;
sbp->sb_mcount++;
} else {
/* Timestamp must be done immediately */
uniqtime(&t);
TIMEVAL_TO_TIMEVAL32(&hp.sbh_timestamp, &t);
pad = Align(hp.sbh_totlen);
hp.sbh_totlen += sizeof (hp);
/* We can't fit this message on the current chunk. */
if ((sbp->sb_mlen + hp.sbh_totlen) > sbp->sb_chunk)
sbclosechunk(sbp);
/*
* If we closed it (just now or during a previous
* call) then allocate the head of a new chunk.
*/
if (sbp->sb_head == NULL) {
/* Allocate leading header of new chunk */
sbp->sb_head = allocb(sizeof (hp), BPRI_MED);
if (sbp->sb_head == NULL) {
/*
* Memory allocation failure.
* This will need to be revisited
* since using certain flag combinations
* can result in messages being dropped
* silently.
*/
freemsg(mp);
sbp->sb_drops++;
return;
}
sbp->sb_mp = sbp->sb_head;
}
/*
* Set the header values and join the message to the
* chunk. The header values are copied into the chunk
* after we adjust for padding below.
*/
hp.sbh_drops = sbp->sb_drops;
hp.sbh_origlen = origlen;
linkb(sbp->sb_head, mp);
sbp->sb_mcount++;
sbp->sb_mlen += hp.sbh_totlen;
/*
* There's no chance to fit another message on the
* chunk -- forgo the padding and close the chunk.
*/
if ((sbp->sb_mlen + pad + SMALLEST_MESSAGE) > sbp->sb_chunk) {
(void) memcpy(sbp->sb_head->b_wptr, (char *)&hp,
sizeof (hp));
sbp->sb_head->b_wptr += sizeof (hp);
ASSERT(sbp->sb_head->b_wptr <=
sbp->sb_head->b_datap->db_lim);
sbclosechunk(sbp);
return;
}
/*
* We may add another message to this chunk -- adjust
* the headers for padding to be added below.
*/
hp.sbh_totlen += pad;
(void) memcpy(sbp->sb_head->b_wptr, (char *)&hp, sizeof (hp));
sbp->sb_head->b_wptr += sizeof (hp);
ASSERT(sbp->sb_head->b_wptr <= sbp->sb_head->b_datap->db_lim);
sbp->sb_mlen += pad;
/*
* Find space for the wrapper. The wrapper consists of:
*
* 1) Padding for this message (this is to ensure each header
* begins on an 8 byte boundary in the userland buffer).
*
* 2) Space for the next message's header, in case the next
* next message will fit in this chunk.
*
* It may be possible to append the wrapper to the last mblk
* of the message, but only if we 'own' the data. If the dblk
* has been shared through dupmsg() we mustn't alter it.
*/
wrapperlen = (sizeof (hp) + pad);
/* Is there space for the wrapper beyond the message's data ? */
for (last = mp; last->b_cont; last = last->b_cont)
;
if ((wrapperlen <= MBLKTAIL(last)) &&
(last->b_datap->db_ref == 1)) {
if (pad > 0) {
/*
* Pad with zeroes to the next pointer boundary
* (we don't want to disclose kernel data to
* users), then advance wptr.
*/
(void) memset(last->b_wptr, 0, pad);
last->b_wptr += pad;
}
/* Remember where to write the header information */
sbp->sb_head = last;
} else {
/* Have to allocate additional space for the wrapper */
wrapper = allocb(wrapperlen, BPRI_MED);
if (wrapper == NULL) {
sbclosechunk(sbp);
return;
}
if (pad > 0) {
/*
* Pad with zeroes (we don't want to disclose
* kernel data to users).
*/
(void) memset(wrapper->b_wptr, 0, pad);
wrapper->b_wptr += pad;
}
/* Link the wrapper msg onto the end of the chunk */
linkb(mp, wrapper);
/* Remember to write the next header in this wrapper */
sbp->sb_head = wrapper;
}
}
}
/*
* Called from timeout().
* Signal a timeout by passing a zero-length M_CTL msg in the read-side
* to synchronize with any active module threads (open, close, wput, rput).
*/
static void
sbtick(void *arg)
{
struct sb *sbp = arg;
queue_t *rq;
ASSERT(sbp);
rq = sbp->sb_rq;
sbp->sb_timeoutid = 0; /* timeout has fired */
if (putctl(rq, M_CTL) == 0) /* failure */
sbp->sb_timeoutid = qtimeout(rq, sbtick, sbp, sbp->sb_ticks);
}
/*
* Close off the currently accumulating chunk and pass
* it upward. Takes care of resetting timers as well.
*
* This routine is called both directly and as a result
* of the chunk timeout expiring.
*/
static void
sbclosechunk(struct sb *sbp)
{
mblk_t *mp;
queue_t *rq;
ASSERT(sbp);
if (sbp->sb_timeoutid) {
(void) quntimeout(sbp->sb_rq, sbp->sb_timeoutid);
sbp->sb_timeoutid = 0;
}
mp = sbp->sb_mp;
rq = sbp->sb_rq;
/*
* If there's currently a chunk in progress, close it off
* and try to send it up.
*/
if (mp) {
sbsendit(rq, mp);
}
/*
* Clear old chunk. Ready for new msgs.
*/
sbp->sb_tail = sbp->sb_mp = sbp->sb_head = NULL;
sbp->sb_mlen = 0;
sbp->sb_mcount = 0;
if (sbp->sb_flags & SB_DEFER_CHUNK)
sbp->sb_state &= ~SB_FRCVD;
}
static void
sbsendit(queue_t *rq, mblk_t *mp)
{
struct sb *sbp = (struct sb *)rq->q_ptr;
if (!canputnext(rq)) {
if (sbp->sb_flags & SB_NO_DROPS)
(void) putq(rq, mp);
else {
freemsg(mp);
sbp->sb_drops += sbp->sb_mcount;
}
return;
}
/*
* If there are messages on the q already, keep
* queueing them since they need to be processed in order.
*/
if (qsize(rq) > 0) {
/* should only get here if SB_NO_DROPS */
(void) putq(rq, mp);
}
else
putnext(rq, mp);
}
| 23.875102 | 80 | 0.634321 |
94c2cc677dc8f5ecc9eaf6e84eff1bec35ee04ec | 479 | rs | Rust | api/src/services/user.rs | sanpii/oxfeed | a8d79bdd115b903bdb05ec475ef4fbc9c1b01108 | [
"MIT"
] | 3 | 2021-05-18T20:53:09.000Z | 2022-01-28T00:00:58.000Z | api/src/services/user.rs | sanpii/oxfeed | a8d79bdd115b903bdb05ec475ef4fbc9c1b01108 | [
"MIT"
] | 38 | 2020-12-03T07:57:15.000Z | 2022-03-22T09:50:35.000Z | api/src/services/user.rs | sanpii/oxfeed | a8d79bdd115b903bdb05ec475ef4fbc9c1b01108 | [
"MIT"
] | 1 | 2021-01-05T18:07:41.000Z | 2021-01-05T18:07:41.000Z | use oxfeed_common::new_user::{Entity, Model};
pub(crate) fn scope() -> actix_web::Scope {
actix_web::web::scope("/users").service(create)
}
#[actix_web::post("")]
async fn create(
elephantry: actix_web::web::Data<elephantry::Pool>,
data: actix_web::web::Json<Entity>,
) -> oxfeed_common::Result<actix_web::HttpResponse> {
elephantry.insert_one::<Model>(&data.into_inner())?;
let response = actix_web::HttpResponse::NoContent().finish();
Ok(response)
}
| 28.176471 | 65 | 0.682672 |
83c479c1b7566092f728d445696b145bae8579e4 | 8,719 | rs | Rust | src/aux_adi4/mux3.rs | wezm/cc2650 | 8f6320feb3a532ea25de78c7530cd64c9765ab1a | [
"Apache-2.0",
"MIT"
] | 2 | 2019-09-10T21:43:36.000Z | 2020-07-20T13:01:40.000Z | src/aux_adi4/mux3.rs | wezm/cc2650 | 8f6320feb3a532ea25de78c7530cd64c9765ab1a | [
"Apache-2.0",
"MIT"
] | null | null | null | src/aux_adi4/mux3.rs | wezm/cc2650 | 8f6320feb3a532ea25de78c7530cd64c9765ab1a | [
"Apache-2.0",
"MIT"
] | null | null | null | #[doc = r" Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::MUX3 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R { bits: self.register.get() }
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `ADCCOMPB_IN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADCCOMPB_INR {
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO0,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO1,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO2,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO3,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO4,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO5,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO6,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO7,
#[doc = "Internal. Only to be used through TI provided API."]
NC,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl ADCCOMPB_INR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
ADCCOMPB_INR::AUXIO0 => 128,
ADCCOMPB_INR::AUXIO1 => 64,
ADCCOMPB_INR::AUXIO2 => 32,
ADCCOMPB_INR::AUXIO3 => 16,
ADCCOMPB_INR::AUXIO4 => 8,
ADCCOMPB_INR::AUXIO5 => 4,
ADCCOMPB_INR::AUXIO6 => 2,
ADCCOMPB_INR::AUXIO7 => 1,
ADCCOMPB_INR::NC => 0,
ADCCOMPB_INR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> ADCCOMPB_INR {
match value {
128 => ADCCOMPB_INR::AUXIO0,
64 => ADCCOMPB_INR::AUXIO1,
32 => ADCCOMPB_INR::AUXIO2,
16 => ADCCOMPB_INR::AUXIO3,
8 => ADCCOMPB_INR::AUXIO4,
4 => ADCCOMPB_INR::AUXIO5,
2 => ADCCOMPB_INR::AUXIO6,
1 => ADCCOMPB_INR::AUXIO7,
0 => ADCCOMPB_INR::NC,
i => ADCCOMPB_INR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `AUXIO0`"]
#[inline]
pub fn is_auxio0(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO0
}
#[doc = "Checks if the value of the field is `AUXIO1`"]
#[inline]
pub fn is_auxio1(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO1
}
#[doc = "Checks if the value of the field is `AUXIO2`"]
#[inline]
pub fn is_auxio2(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO2
}
#[doc = "Checks if the value of the field is `AUXIO3`"]
#[inline]
pub fn is_auxio3(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO3
}
#[doc = "Checks if the value of the field is `AUXIO4`"]
#[inline]
pub fn is_auxio4(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO4
}
#[doc = "Checks if the value of the field is `AUXIO5`"]
#[inline]
pub fn is_auxio5(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO5
}
#[doc = "Checks if the value of the field is `AUXIO6`"]
#[inline]
pub fn is_auxio6(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO6
}
#[doc = "Checks if the value of the field is `AUXIO7`"]
#[inline]
pub fn is_auxio7(&self) -> bool {
*self == ADCCOMPB_INR::AUXIO7
}
#[doc = "Checks if the value of the field is `NC`"]
#[inline]
pub fn is_nc(&self) -> bool {
*self == ADCCOMPB_INR::NC
}
}
#[doc = "Values that can be written to the field `ADCCOMPB_IN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADCCOMPB_INW {
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO0,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO1,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO2,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO3,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO4,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO5,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO6,
#[doc = "Internal. Only to be used through TI provided API."]
AUXIO7,
#[doc = "Internal. Only to be used through TI provided API."]
NC,
}
impl ADCCOMPB_INW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
ADCCOMPB_INW::AUXIO0 => 128,
ADCCOMPB_INW::AUXIO1 => 64,
ADCCOMPB_INW::AUXIO2 => 32,
ADCCOMPB_INW::AUXIO3 => 16,
ADCCOMPB_INW::AUXIO4 => 8,
ADCCOMPB_INW::AUXIO5 => 4,
ADCCOMPB_INW::AUXIO6 => 2,
ADCCOMPB_INW::AUXIO7 => 1,
ADCCOMPB_INW::NC => 0,
}
}
}
#[doc = r" Proxy"]
pub struct _ADCCOMPB_INW<'a> {
w: &'a mut W,
}
impl<'a> _ADCCOMPB_INW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: ADCCOMPB_INW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio0(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO0)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio1(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO1)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio2(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO2)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio3(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO3)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio4(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO4)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio5(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO5)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio6(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO6)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn auxio7(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::AUXIO7)
}
#[doc = "Internal. Only to be used through TI provided API."]
#[inline]
pub fn nc(self) -> &'a mut W {
self.variant(ADCCOMPB_INW::NC)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 255;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u8) << OFFSET);
self.w.bits |= ((value & MASK) as u8) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
#[doc = "Bits 0:7 - Internal. Only to be used through TI provided API."]
#[inline]
pub fn adccompb_in(&self) -> ADCCOMPB_INR {
ADCCOMPB_INR::_from({
const MASK: u8 = 255;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u8) as u8
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:7 - Internal. Only to be used through TI provided API."]
#[inline]
pub fn adccompb_in(&mut self) -> _ADCCOMPB_INW {
_ADCCOMPB_INW { w: self }
}
}
| 30.486014 | 76 | 0.551439 |
5c9d7d3a91acb88753cb1787b4f81c28821a2786 | 719 | asm | Assembly | oeis/321/A321875.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/321/A321875.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/321/A321875.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A321875: a(n) = Sum_{d|n} d*d!.
; Submitted by Jamie Morken(s1.)
; 1,5,19,101,601,4343,35281,322661,3265939,36288605,439084801,5748023639,80951270401,1220496112085,19615115520619,334764638530661,6046686277632001,115242726706374263,2311256907767808001,48658040163569088701,1072909785605898275299,24728016011107808044805,594596384994354462720001,14890761641597752292986199,387780251083274649600000601,10485577989291746606135270405,293999475161295508340739265939,8536873649127988095262608112181,256411097818451356681764864000001,7957585794365731759108869551812943
add $0,1
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
mov $4,$0
sub $0,1
add $1,$3
mul $1,$4
lpe
mov $0,$1
add $0,1
| 35.95 | 495 | 0.802503 |
538935c8fa63a77f88e83c9f79986938d9c0c12b | 2,953 | kt | Kotlin | data_collector/src/opencrx/models/Responses.kt | nikolasrist/soa_project | 71a1282c2fa4400ef75c1cfc48c74a53e4a7ca6d | [
"MIT"
] | null | null | null | data_collector/src/opencrx/models/Responses.kt | nikolasrist/soa_project | 71a1282c2fa4400ef75c1cfc48c74a53e4a7ca6d | [
"MIT"
] | 3 | 2020-03-04T23:30:55.000Z | 2020-06-18T16:45:06.000Z | data_collector/src/opencrx/models/Responses.kt | nikolasrist/soa_project | 71a1282c2fa4400ef75c1cfc48c74a53e4a7ca6d | [
"MIT"
] | null | null | null | package opencrx.models
import com.fasterxml.jackson.annotation.JsonAutoDetect
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import io.ktor.http.HttpStatusCode
sealed class Response
@JsonIgnoreProperties(ignoreUnknown = true)
data class Account(
val firstName: String? = "",
val lastName: String? = "",
val fullName: String? = "",
val familyStatus: Int = 0,
val organization: String? = "",
val jobTitle: String? = "",
val gender: Int = 0,
val preferredSpokenLanguage: Int = 0,
val accountRating: Int = 0,
val industry: String? = "",
val annualIncomeCurrency: Int = 0,
@JsonProperty("@href") val accountUrl: String? = ""
)
@JsonIgnoreProperties(ignoreUnknown = true)
data class AccountList(
val objects: List<Account>
)
data class AccountResponse(
val data: Account
) : Response()
data class AccountListResponse(
val data: AccountList
) : Response()
data class ErrorResponse(
val message: String,
val status: HttpStatusCode
) : Response()
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
data class AssignedContract(
@JsonProperty("@type") val type: String? = "",
@JsonProperty("@href") val salesOrderUrl: String? = "",
val customer: Customer
)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
data class Customer(
@JsonProperty("@href") val customerUrl: String? = ""
)
@JsonIgnoreProperties(ignoreUnknown = true)
data class ContractList(
val objects: List<AssignedContract>
)
data class ContractListResponse(
val data: ContractList
) : Response()
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
data class SalesOrderPosition(
val baseAmount: String,
val quantity: String,
val product: Product
)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
data class Product(
@JsonProperty("@href") val reference: String? = "",
val name: String? = "",
val productNumber: Int? = 0
)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
data class ProductResponse(
val data: Product
) : Response()
@JsonIgnoreProperties(ignoreUnknown = true)
data class SalesOrderPositionList(
val objects: List<SalesOrderPosition>
)
data class SalesOrderPositionListResponse(
val data: SalesOrderPositionList
) : Response()
data class ClientInfoDTO(
var salesmanName: String = "",
var salesInfos: ArrayList<SalesInfoDTO> = ArrayList()
)
@JsonIgnoreProperties(ignoreUnknown = true)
data class SalesInfoDTO(
var productName: String = "",
var clientName: String = "",
var clientRanking: Int = 0,
var quantity: Double = 0.0,
var bonus: Int = 0
)
| 26.845455 | 64 | 0.732475 |
55b574c7f94d6b70500c3ea245b8b0e74f3c2a7c | 21,968 | asm | Assembly | Project/main.asm | mpetitjean/avrdude | f769629a0d4014d6b84f2089d8802ec075bbaa01 | [
"MIT"
] | null | null | null | Project/main.asm | mpetitjean/avrdude | f769629a0d4014d6b84f2089d8802ec075bbaa01 | [
"MIT"
] | null | null | null | Project/main.asm | mpetitjean/avrdude | f769629a0d4014d6b84f2089d8802ec075bbaa01 | [
"MIT"
] | null | null | null | ;
; PROJECT
; EnigmAssembly
;
; Authors : Mathieu Petitjean & Cedric Hannotier
.include "m328pdef.inc"
;--------
; ALIASES
;--------
; KEYBOARD NUMEROTATION
.equ KEYB_PIN = PIND
.equ KEYB_DDR = DDRD
.equ KEYB_PORT = PORTD
.equ ROW1 = 7
.equ ROW2 = 6
.equ ROW3 = 5
.equ ROW4 = 4
.equ COL1 = 3
.equ COL2 = 2
.equ COL3 = 1
.equ COL4 = 0
; LEDs
.equ LEDUP_P = 2
.equ LEDDOWN_P = 3
.equ LED_DDR = DDRC
.equ LED_PORT = PORTC
.equ LED_PIN = PINC
;JOYSTICK
.equ JOYSTICK_DDR = DDRB
.equ JOYSTICK_PORT = PORTB
.equ JOYSTICK_PIN = PINB
.equ JOYSTICK_P = 2
; SCREEN
.equ SCREEN_DDR = DDRB
.equ SCREEN_PORT = PORTB
.equ SCREEN_PIN = PINB
.equ SCREEN_SDI = 3
.equ SCREEN_CLK = 5
.equ SCREEN_LE = 4
;TCNT 1 RESET VALUE
.EQU TCNT2_RESET_480 = 245
.EQU TCNT0_RESET_1M = 55
;Define some Register name
.DEF zero = r0 ; Just a 0
.DEF switch = r1 ; To alternate low and high part of byte (for keyboard)
.DEF cleareg = r2 ; Value offset to space ASCII character
.DEF eof = r3 ; Value offset to EOF ASCII character
.DEF pushapop = r4 ; Push and Pop register (avoid to access RAM)
.DEF lborderlow = r5 ; Verify we do not "underflow"
.DEF lborderhigh= r6 ; Verify we do not "underflow"
.DEF rborderlow = r7 ; Verify we do not "overflow"
.DEF rborderhigh= r8 ; Verify we do not "overflow"
.DEF tmp = r16 ; Register for tmp value
.DEF asciiof = r17 ; To store the offset for ASCII table
.DEF stepreg = r18 ; Write or XOR (0 = Write)
.DEF state = r19 ; Encryption or Decryption (0 = Encryption)
.DEF statejoy = r20 ; Joystick pressed or not (0 = Pressed)
.DEF rowpos = r21 ; Know the row to switch on
.DEF rownumber = r22 ; Select the column corresponding to the right row
;Memory
.DSEG
DisplayMem: .BYTE 17; ASCII offset/cell
.CSEG
;--------
; MACROS
;--------
; Fill in the shift register for screen
.MACRO push2Shift
SBI SCREEN_PORT, SCREEN_SDI
SBRS @0, @1 ; Set to 0 if needed
CBI SCREEN_PORT, SCREEN_SDI
SBI SCREEN_PIN,SCREEN_CLK ; Push value
SBI SCREEN_PIN,SCREEN_CLK
.ENDMACRO
; Store part of ASCII offset in low or high part of asciiof register
; if switch(0) = 1 → low part, else high
.MACRO HexToASCII
SBR asciiof, @0
SBRS switch, 0
LDI asciiof, @0<<4
.ENDMACRO
; Wait
.MACRO loop
CLR tmp
begin@0:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DEC tmp
BRNE begin@0
.ENDMACRO
;Clear offset memory (spaces)
.MACRO clearMem
LDI YH, high(DisplayMem)
LDI YL, low(DisplayMem)
; Clear Screen (put spaces everywhere)
LDI tmp, 32
ST Y, tmp
STD Y+1, tmp
STD Y+2, tmp
STD Y+3, tmp
STD Y+4, tmp
STD Y+5, tmp
STD Y+6, tmp
STD Y+7, tmp
STD Y+8, tmp
STD Y+9, tmp
STD Y+10, tmp
STD Y+11, tmp
STD Y+12, tmp
STD Y+13, tmp
STD Y+14, tmp
STD Y+15, tmp
.ENDMACRO
; Detect key pressed from keyboard (step 2 of two-steps method)
.MACRO invertKeyboard
; Switch in/out for rows and columns
LDI tmp,(1<<ROW1)|(1<<ROW2)|(1<<ROW3)|(1<<ROW4)
OUT KEYB_PORT,tmp
LDI tmp,(1<<COL1)|(1<<COL2)|(1<<COL3)|(1<<COL4)
OUT KEYB_DDR,tmp
loop key2
; Check which row is LOW
SBIS KEYB_PIN,ROW1
RJMP @0
SBIS KEYB_PIN,ROW2
RJMP @1
SBIS KEYB_PIN,ROW3
RJMP @2
SBIS KEYB_PIN,ROW4
RJMP @3
RJMP reset
.ENDMACRO
; Write one column configuration of one cell
.MACRO displayRow
LDI ZL, low(DisplayMem)
LDI ZH, high(DisplayMem)
ADIW ZL, @0 ; Point to the correct cell
LD tmp, Z ; Store in tmp ASCII offset
LDI ZH, high(ASCII<<1) ; ASCII table adress
LDI ZL, low(ASCII<<1)
LSL tmp
ADD ZL, tmp ; Point to the correct ASCII character
ADC ZH, zero
LPM tmp, Z+ ; Store the high part of the adress of the character configuration (columns)
LPM ZH, Z ; Same with the low part
MOV ZL, tmp
ADD ZL, rownumber ; Point to the correct column regarding to the row
ADC ZH, zero
LPM tmp, Z ; Store in tmp the column configuration
push2Shift tmp, 0 ; Write in shift register (display) the column configuration for that cell
push2Shift tmp, 1
push2Shift tmp, 2
push2Shift tmp, 3
push2Shift tmp, 4
.ENDMACRO
;-------
; CODE
;-------
.ORG 0x0000
rjmp init
.ORG 0x0012
rjmp timer2_ovf
init:
; Screen configuration
; Set SDI, CLK, LE as output - set them at LOW
LDI tmp, (1<<SCREEN_SDI)|(1<<SCREEN_CLK)|(1<<SCREEN_LE)
OUT SCREEN_PORT, tmp
OUT SCREEN_DDR, tmp
; Configure LEDs as outputs - set to HIGH to be off
SBI LED_DDR,LEDUP_P
SBI LED_DDR,LEDDOWN_P
SBI LED_PORT,LEDUP_P
SBI LED_PORT,LEDDOWN_P
; Configure joystick stick
CBI JOYSTICK_DDR,JOYSTICK_P
SBI JOYSTICK_PORT,JOYSTICK_P
; Clear useful registers
CLR zero
CLR switch
CLR stepreg
CLR state
; Reg initial values
LDI rownumber, 6 ; Number of rows
LDI rowpos, 1<<6 ; Selection of the first row
LDI tmp, 8
MOV cleareg, tmp ; Offset to blank space
LDI tmp, 3
MOV eof, tmp ; Offset to EOF
LDI statejoy, 1 ; Joystick not pressed
; Adress DisplayMem - 1 (outside of the screen)
LDI tmp, low(DisplayMem-1)
MOV lborderlow, tmp
LDI tmp, high(DisplayMem-1)
MOV lborderhigh, tmp
; Adress DisplayMem + 17 (outside + 1 of the screen to avoid breaking backspace)
LDI tmp, low(DisplayMem+17)
MOV rborderlow, tmp
LDI tmp, high(DisplayMem+17)
MOV tmp, rborderhigh
; Store DisplayMem table adress in Y, point to the next cell we need to configure and clear the memory to show spaces.
clearMem
; TIMER 2 - each line needs to be refreshed at 60Hz
; configure timer 2 in normal mode (count clk signals)
; WGM20 = 0 WGM21 = 0
LDS tmp,TCCR2A
CBR tmp,(1<<WGM20)|(1<<WGM21)
STS TCCR2A,tmp
; configure prescaler to 1024
; CS12=0 CS11=0 CS10=1
LDS tmp,TCCR2B
CBR tmp,(1<<WGM22)
SBR tmp,(1<<CS22)|(1<<CS21)|(1<<CS20)
STS TCCR2B,tmp
; activate overflow interrupt timer 2
; set TOIE12
LDS tmp,TIMSK2
SBR tmp,(1<<TOIE2)
STS TIMSK2,tmp
; Activate global interrupt
SEI
; clear T register
CLT
RJMP main
main:
CPSE YL, lborderlow
RJMP overflow
CPSE YH, lborderhigh
RJMP overflow
LDI YL, low(DisplayMem)
LDI YH, high(DisplayMem)
RJMP JoystickCheck
overflow:
CPSE YL, rborderlow
RJMP JoystickCheck
CPSE YH, rborderhigh
RJMP JoystickCheck
LDI YL, low(DisplayMem+16)
LDI YH, high(DisplayMem+16)
; Check state of the joystick
JoystickCheck:
IN tmp, JOYSTICK_PIN
; If pressed, bit is cleared → skip
SBRS tmp, JOYSTICK_P
RJMP pressed
; Skip if coming from pressed state
CPSE statejoy, zero
RJMP keyboard
LDI statejoy, 1
; Skip if coming from encryption
CPSE state, zero
RJMP bigclear
; Point to the first cell
LDI YL, low(DisplayMem)
LDI YH, high(DisplayMem)
; Set to XOR and decryption state
LDI stepreg, 1
LDI state,1
; Turn on the LED (PC3)
CBI LED_PORT,LEDDOWN_P
; Go to keyboard detection
RJMP keyboard
; Clear the screen and go back to first cell
bigclear:
clearMem
LDI stepreg, 0
LDI state, 0
RJMP keyboard
; Joystick was pressed
pressed:
LDI statejoy, 0 ; Change state of the Joystick
SBI LED_PORT,LEDDOWN_P
RJMP keyboard ; Go to keyboard detection
; STEP 1 of Keyboard check
; Check if all COL are HIGH
; First set all rows to LOW as output and cols as inputs
keyboard:
LDI tmp,(1<<COL1)|(1<<COL2)|(1<<COL3)|(1<<COL4)
OUT KEYB_PORT,tmp
LDI tmp,(1<<ROW1)|(1<<ROW2)|(1<<ROW3)|(1<<ROW4)
OUT KEYB_DDR,tmp
loop key1
; COLx is LOW => check for the rows (step2)
SBIS KEYB_PIN,COL1
RJMP C1Pressed
SBIS KEYB_PIN,COL2
RJMP C2Pressed
SBIS KEYB_PIN,COL3
RJMP C3Pressed
SBIS KEYB_PIN,COL4
RJMP C4Pressed
RJMP reset
; No COL is detected to be pressed, rows are not checked
reset:
BRTC jumptomain ; If T = 0 → no key pressed → jump to main
INC switch ; If T = 1 → key pressed → increment the switch(select if low or high part of a byte)
SBI LED_PIN,LEDUP_P
CLT ; Clear T
SBRC switch, 0 ; Skip if byte is full (second key pressed)
jumptomain: RJMP main
CPSE eof, asciiof
RJMP pwdencode ; Go to pwdencode if NOT eof as last character
INC stepreg ; Switch step state
LDI YL, low(DisplayMem) ; Go back to first cell
LDI YH, high(DisplayMem)
RJMP main
pwdencode:
SBRS stepreg, 0 ; Skip if in XOR
RJMP clear
LD tmp, Y ; Load current offset
EOR asciiof, tmp
ST Y+, asciiof
RJMP main
clear:
CPSE cleareg, asciiof ; Skip if typed a clear (backspace)
RJMP messagein
ST -Y, asciiof
RJMP main
messagein: SBRS switch, 0 ; Skip if switch(0) = 1 (meaning that we only have written the high part of the ASCII offset)
ST Y+, asciiof ; If ASCCI offset written → store it in the correct part of the cell table
RJMP main
C1Pressed:
invertKeyboard C1R1Pressed,C1R2Pressed,C1R3Pressed,C1R4Pressed
C2Pressed:
invertKeyboard C2R1Pressed,C2R2Pressed,C2R3Pressed,C2R4Pressed
C3Pressed:
invertKeyboard C3R1Pressed,C3R2Pressed,C3R3Pressed,C3R4Pressed
C4Pressed:
invertKeyboard C4R1Pressed,C4R2Pressed,C4R3Pressed,C4R4Pressed
C1R1Pressed:
; 7 pressed ->
HexToASCII $7
SET
RJMP main
C1R2Pressed:
; 4 pressed ->
HexToASCII $4
SET
RJMP main
C1R3Pressed:
; 1 pressed ->
HexToASCII $1
SET
RJMP main
C1R4Pressed:
; A pressed ->
HexToASCII $A
SET
RJMP main
C2R1Pressed:
; 8 pressed ->
HexToASCII $8
SET
RJMP main
C2R2Pressed:
; 5 pressed ->
HexToASCII $5
SET
RJMP main
C2R3Pressed:
; 2 pressed ->
HexToASCII $2
SET
RJMP main
C2R4Pressed:
; 0 pressed ->
HexToASCII $0
SET
RJMP main
C3R1Pressed:
; 9 pressed ->
HexToASCII $9
SET
RJMP main
C3R2Pressed:
; 6 pressed ->
HexToASCII $6
SET
RJMP main
C3R3Pressed:
; 3 pressed ->
HexToASCII $3
SET
RJMP main
C3R4Pressed:
; B pressed ->
HexToASCII $B
SET
RJMP main
C4R1Pressed:
; F pressed ->
HexToASCII $F
SET
RJMP main
C4R2Pressed:
; E pressed ->
HexToASCII $E
SET
RJMP main
C4R3Pressed:
; D pressed ->
HexToASCII $D
SET
RJMP main
C4R4Pressed:
; C pressed ->
HexToASCII $C
SET
RJMP main
timer2_ovf:
; Interruption routine at around 60Hz/line
MOV pushapop, tmp ; Save current value of tmp, faster than stack
; Reset timer counter
LDI tmp,TCNT2_RESET_480
STS TCNT2,tmp
; Write column configurations of each cell
displayRow 15
displayRow 14
displayRow 13
displayRow 12
displayRow 11
displayRow 10
displayRow 9
displayRow 8
displayRow 7
displayRow 6
displayRow 5
displayRow 4
displayRow 3
displayRow 2
displayRow 1
displayRow 0
; Useless row of the shift register
CBI SCREEN_PORT,SCREEN_SDI
SBI SCREEN_PIN,SCREEN_CLK
SBI SCREEN_PIN,SCREEN_CLK
; Write row configuration (switch on a row)
push2Shift rowpos, 6
push2Shift rowpos, 5
push2Shift rowpos, 4
push2Shift rowpos, 3
push2Shift rowpos, 2
push2Shift rowpos, 1
push2Shift rowpos, 0
; Prepare for the next iteration (upper row)
DEC rownumber
LSR rowpos
BRNE end ; If we did all the rows → jump to the bottom (row)
LDI rowpos, 1<<6
LDI rownumber, 6
; Set SCREEN_LE HIGH, wait a suficient amount of time
end:
SBI SCREEN_PIN,SCREEN_LE
loop screenLoop
SBI SCREEN_PIN,SCREEN_LE
; Retrieve the tmp value
MOV tmp, pushapop
; Return
RETI
;-------
; TABLES
;-------
ASCII:
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterSpace<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterSpace<<1
.dw CharacterExclam<<1
.dw CharacterQuote<<1
.dw CharacterHash<<1
.dw CharacterDollar<<1
.dw CharacterPercent<<1
.dw CharacterAnd<<1
.dw CharacterPrime<<1
.dw CharacterParLeft<<1
.dw CharacterParRight<<1
.dw CharacterStar<<1
.dw CharacterPlus<<1
.dw CharacterComma<<1
.dw CharacterLine<<1
.dw CharacterDot<<1
.dw CharacterSlash<<1
.dw Character0<<1
.dw Character1<<1
.dw Character2<<1
.dw Character3<<1
.dw Character4<<1
.dw Character5<<1
.dw Character6<<1
.dw Character7<<1
.dw Character8<<1
.dw Character9<<1
.dw CharacterDoubleDot<<1
.dw CharacterSemiCol<<1
.dw CharacterLower<<1
.dw CharacterEqual<<1
.dw CharacterGreater<<1
.dw CharacterInterrogation<<1
.dw CharacterAt<<1
.dw CharacterA<<1
.dw CharacterB<<1
.dw CharacterC<<1
.dw CharacterD<<1
.dw CharacterE<<1
.dw CharacterF<<1
.dw CharacterG<<1
.dw CharacterH<<1
.dw CharacterI<<1
.dw CharacterJ<<1
.dw CharacterK<<1
.dw CharacterL<<1
.dw CharacterM<<1
.dw CharacterN<<1
.dw CharacterO<<1
.dw CharacterP<<1
.dw CharacterQ<<1
.dw CharacterR<<1
.dw CharacterS<<1
.dw CharacterT<<1
.dw CharacterU<<1
.dw CharacterV<<1
.dw CharacterW<<1
.dw CharacterX<<1
.dw CharacterY<<1
.dw CharacterZ<<1
.dw CharacterBracketLeft<<1
.dw CharacterBackslash<<1
.dw CharacterBracketRight<<1
.dw CharacterHat<<1
.dw CharacterUnderscore<<1
.dw CharacterGAccent<<1
.dw Characteral<<1
.dw Characterbl<<1
.dw Charactercl<<1
.dw Characterdl<<1
.dw Characterel<<1
.dw Characterfl<<1
.dw Charactergl<<1
.dw Characterhl<<1
.dw Characteril<<1
.dw Characterjl<<1
.dw Characterkl<<1
.dw Characterll<<1
.dw Characterml<<1
.dw Characternl<<1
.dw Characterol<<1
.dw Characterpl<<1
.dw Characterql<<1
.dw Characterrl<<1
.dw Charactersl<<1
.dw Charactertl<<1
.dw Characterul<<1
.dw Charactervl<<1
.dw Characterwl<<1
.dw Characterxl<<1
.dw Characteryl<<1
.dw Characterzl<<1
.dw CharacterLeftBrace<<1
.dw CharacterSep<<1
.dw CharacterRightBrace<<1
.dw CharacterTilde<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
CharacterEmpty:
.db 0, 0, 0, 0b100, 0, 0, 0, 0
CharacterSpace:
.db 0, 0, 0, 0, 0, 0, 0, 0
CharacterExclam:
.db 0b100, 0b100, 0b100, 0b100, 0b100, 0, 0b100, 0
CharacterQuote:
.db 0, 0b01010, 0b01010, 0, 0, 0, 0, 0
CharacterHash:
.db 0, 0b01010, 0b11111, 0b01010, 0b11111, 0b01010, 0, 0
CharacterDollar:
.db 0b0111, 0b1100, 0b1100, 0b0110, 0b0101, 0b0101, 0b1110, 0
CharacterPercent:
.db 0b11000, 0b11001, 0b00010, 0b00100, 0b01000, 0b10011, 0b11, 0
CharacterAnd:
.db 0b110, 0b1001, 0b1010, 0b100, 0b1010, 0b1001, 0b0100, 0
CharacterPrime:
.db 0, 0b00100, 0b00100, 0, 0, 0, 0, 0
CharacterParLeft:
.db 0b00100, 0b1000, 0b1000, 0b1000, 0b1000, 0b1000, 0b100, 0
CharacterParRight:
.db 0b00100, 0b10, 0b10, 0b10, 0b10, 0b10, 0b100, 0
CharacterStar:
.db 0b100, 0b100, 0b11111, 0b100, 0b1010, 0b10001, 0, 0
CharacterPlus:
.db 0, 0b100, 0b100, 0b11111, 0b100, 0b100, 0, 0
CharacterComma:
.db 0, 0, 0, 0, 0b100, 0b100, 0b1000, 0
CharacterLine:
.db 0, 0, 0, 0b1110, 0, 0, 0, 0
CharacterDot:
.db 0, 0, 0, 0, 0, 0, 0b100, 0
CharacterSlash:
.db 0, 1, 2, 4, 8, 16, 0, 0
CharacterA:
.db 0b00110, 0b01001, 0b01001, 0b01001, 0b01111, 0b01001, 0b01001, 0
CharacterB:
.db 0b01110, 0b01001, 0b01001, 0b01110, 0b01001, 0b01001, 0b01110, 0
CharacterC:
.db 0b00111, 0b01000, 0b01000, 0b01000, 0b01000, 0b01000, 0b00111, 0
CharacterD:
.db 0b01110, 0b01001, 0b01001, 0b01001, 0b01001, 0b01001, 0b01110, 0
CharacterE:
.db 0b01111, 0b01000, 0b01000, 0b01110, 0b01000, 0b01000, 0b01111, 0
CharacterF:
.db 0b1111, 0b1000, 0b1000, 0b1110, 0b1000, 0b1000, 0b1000, 0
CharacterG:
.db 0b1111, 0b1000, 0b1000, 0b1000, 0b1011, 0b1001, 0b1111, 0
CharacterH:
.db 0b1001, 0b1001, 0b1001, 0b1111, 0b1001, 0b1001, 0b1001, 0
CharacterI:
.db 0b01110, 0b0100, 0b0100, 0b0100, 0b0100, 0b0100, 0b01110, 0
CharacterJ:
.db 0b1111, 0b0001, 0b0001, 0b0001, 0b0001, 0b1001, 0b0110, 0
CharacterK:
.db 0b1001, 0b1010, 0b1100, 0b1000, 0b1100, 0b1010, 0b1001, 0
CharacterL:
.db 0b1000, 0b1000, 0b1000, 0b1000, 0b1000, 0b1000, 0b1111, 0
CharacterM:
.db 0b1001, 0b1111, 0b1111, 0b1001, 0b1001, 0b1001, 0b1001, 0
CharacterN:
.db 0b1001, 0b1101, 0b1011, 0b1001, 0b1001, 0b1001, 0b1001, 0
CharacterO:
.db 0b1111, 0b1001, 0b1001, 0b1001, 0b1001, 0b1001, 0b1111, 0
CharacterP:
.db 0b1111, 0b1001, 0b1001, 0b1111, 0b1000, 0b1000, 0b1000, 0
CharacterQ:
.db 0b0110, 0b1001, 0b1001, 0b1001, 0b0111, 0b0010, 0b0001, 0
CharacterR:
.db 0b1111, 0b1001, 0b1001, 0b1111, 0b1100, 0b1010, 0b1001, 0
CharacterS:
.db 0b0111, 0b1000, 0b1000, 0b0110, 0b0001, 0b0001, 0b1110, 0
CharacterT:
.db 0b11111, 0b0100, 0b0100, 0b0100, 0b0100, 0b0100, 0b0100, 0
CharacterU:
.db 0b1001, 0b1001, 0b1001, 0b1001, 0b1001, 0b1001, 0b1111, 0
CharacterV:
.db 0b1010, 0b1010, 0b1010, 0b1010, 0b1010, 0b1010, 0b0100, 0
CharacterW:
.db 0b1001, 0b1001, 0b1001, 0b1001, 0b1111, 0b1111, 0b1001, 0
CharacterX:
.db 0b1001, 0b1001, 0b1001, 0b0110, 0b1001, 0b1001, 0b1001, 0
CharacterY:
.db 0b1001, 0b1001, 0b1001, 0b0111, 0b0010, 0b0100, 0b1000, 0
CharacterZ:
.db 0b1111, 0b0001, 0b0001, 0b0110, 0b1000, 0b1000, 0b1111, 0
Character0:
.db 0b01111, 0b01001, 0b01001, 0b01001, 0b01001, 0b01001, 0b01111, 0
Character1:
.db 0b00010, 0b00110, 0b01010, 0b00010, 0b00010, 0b00010, 0b00010, 0
Character2:
.db 0b01111, 0b00001, 0b00001, 0b01111, 0b01000, 0b01000, 0b01111, 0
Character3:
.db 0b01111, 0b00001, 0b00001, 0b00111, 0b00001, 0b00001, 0b01111, 0
Character4:
.db 0b01001, 0b01001, 0b01001, 0b01111, 0b00001, 0b00001, 0b00001, 0
Character5:
.db 0b01111, 0b01000, 0b01000, 0b01111, 0b00001, 0b00001, 0b01111, 0
Character6:
.db 0b01111, 0b01000, 0b01000, 0b01111, 0b01001, 0b01001, 0b01111, 0
Character7:
.db 0b01111, 0b00001, 0b00001, 0b00010, 0b00100, 0b00100, 0b00100, 0
Character8:
.db 0b01111, 0b01001, 0b01001, 0b01111, 0b01001, 0b01001, 0b01111, 0
Character9:
.db 0b01111, 0b01001, 0b01001, 0b01111, 0b00001, 0b00001, 0b01111, 0
CharacterDoubleDot:
.db 0, 0, 0b00100, 0, 0b00100, 0, 0, 0
CharacterSemiCol:
.db 0, 0, 0b00100, 0, 0b00100, 0b00100, 0b01000, 0
CharacterLower:
.db 0, 0b00010, 0b00100, 0b01000, 0b00100, 0b00010, 0, 0
CharacterEqual:
.db 0, 0, 0b01110, 0, 0b01110, 0, 0, 0
CharacterGreater:
.db 0, 0b01000, 0b00100, 0b00010, 0b00100, 0b01000, 0, 0
CharacterInterrogation:
.db 0b01110, 0b01010, 0b00010, 0b00110, 0b00100, 0, 0b00100, 0
CharacterAt:
.db 0, 0b11111, 0b00001, 0b01101, 0b01101, 0b01001, 0b01111, 0
CharacterBracketLeft:
.db 0b1100, 0b1000, 0b01000, 0b01000, 0b01000, 0b01000, 0b1100, 0
CharacterBackslash:
.db 0, 16, 8, 4, 2, 1, 0, 0
CharacterBracketRight:
.db 0b110, 2, 2, 2, 2, 2, 0b110, 0
CharacterHat:
.db 0, 4, 0b01010, 0, 0, 0, 0, 0
CharacterUnderscore:
.db 0, 0, 0, 0, 0, 0b01110, 0, 0
CharacterGAccent:
.db 0, 4, 2, 0, 0, 0, 0, 0
Characteral:
.db 0, 0, 0b00110, 1, 0b111, 0b1001, 0b111, 0
Characterbl:
.db 8, 8, 8, 0b1110, 0b1001, 0b1001, 0b1110, 0
Charactercl:
.db 0, 0, 0b110, 8, 8, 8, 0b110, 0,
Characterdl:
.db 1, 1, 1, 0b111, 0b1001, 0b1001, 0b111, 0
Characterel:
.db 0, 0b110, 0b1001, 0b1111, 8, 8, 0b111, 0
Characterfl:
.db 0, 3, 4, 0b1110, 4, 4, 4, 0
Charactergl:
.db 0, 0b101, 0b1011, 0b1011, 0b101, 1, 0b111, 0
Characterhl:
.db 0, 8, 8, 8, 0b1110, 0b1010, 0b1010, 0
Characteril:
.db 0, 4, 0, 4, 4, 4, 4, 0
Characterjl:
.db 0, 4, 0, 4, 4, 4, 0b11000, 0
Characterkl:
.db 0, 8, 8, 0b1010, 0b1100, 0b1010, 0b1010, 0
Characterll:
.db 0, 4, 4, 4, 4, 4, 4, 0
Characterml:
.db 0, 0, 0b01010, 0b10101, 0b10101, 0b10101, 0b10101, 0
Characternl:
.db 0, 0, 0b0100, 0b1010, 0b1010, 0b1010, 0b1010, 0
Characterol:
.db 0, 0, 0b1110, 0b1010, 0b1010, 0b1010, 0b1110, 0
Characterpl:
.db 0, 0, 0b1110, 0b1010, 0b1110, 8, 8, 0
Characterql:
.db 0, 0, 0b1110, 0b1010, 0b1110, 2, 2, 0
Characterrl:
.db 0, 0, 6, 8, 8, 8, 8, 0
Charactersl:
.db 0, 0, 0b1110, 16, 12, 2, 0b11100, 0
Charactertl:
.db 0, 8, 0b1110, 8, 8, 8, 0b110, 0
Characterul:
.db 0, 0, 0, 10, 10, 10, 14, 0
Charactervl:
.db 0, 0, 0, 10, 10, 10, 4, 0
Characterwl:
.db 0, 0, 0, 0b10101, 0b10101, 0b10101, 10, 0
Characterxl:
.db 0, 0, 17, 10, 4, 10, 17, 0
Characteryl:
.db 0, 0, 10, 10, 4, 4, 4, 0
Characterzl:
.db 0, 0, 0, 15, 2, 4, 15, 0
CharacterLeftBrace:
.db 3, 4, 4, 8, 4, 4, 3, 0
CharacterSep:
.db 4, 4, 4, 4, 4, 4, 4, 0
CharacterRightBrace:
.db 12, 2, 2, 1, 2, 2, 12, 0
CharacterTilde:
.db 0, 0, 5, 10, 0, 0, 0, 0
| 22.531282 | 129 | 0.643481 |
582ea5a840143ec7ff8b34119814e11de0112079 | 593 | kt | Kotlin | src/main/kotlin/me/branchpanic/mods/stockpile/extension/itemstack.kt | campbebj/stockpile | 26042b21213b69f47bbf267b25e33b0463b82edc | [
"MIT"
] | null | null | null | src/main/kotlin/me/branchpanic/mods/stockpile/extension/itemstack.kt | campbebj/stockpile | 26042b21213b69f47bbf267b25e33b0463b82edc | [
"MIT"
] | null | null | null | src/main/kotlin/me/branchpanic/mods/stockpile/extension/itemstack.kt | campbebj/stockpile | 26042b21213b69f47bbf267b25e33b0463b82edc | [
"MIT"
] | null | null | null | package me.branchpanic.mods.stockpile.extension
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.ItemStack
fun ItemStack.canStackWith(other: ItemStack): Boolean = isEmpty ||
other.isEmpty ||
(ItemStack.areItemsEqual(withCount(1), other.withCount(1)) && ItemStack.areTagsEqual(
this,
other
))
fun ItemStack.withCount(count: Int): ItemStack {
val newStack = copy()
newStack.count = count
return newStack
}
fun ItemStack.giveTo(player: PlayerEntity) {
player.inventory.offerOrDrop(player.world, this)
}
| 26.954545 | 93 | 0.70489 |
5eaccffd43d95ff7e7b96f937d107037153c83ee | 24,391 | sql | SQL | coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-3_2-SCRIPT/mysql/dml/KC_DML_01_KCIRB-1470_B000.sql | smith750/kc | e411ed1a4f538a600e04f964a2ba347f5695837e | [
"ECL-2.0"
] | null | null | null | coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-3_2-SCRIPT/mysql/dml/KC_DML_01_KCIRB-1470_B000.sql | smith750/kc | e411ed1a4f538a600e04f964a2ba347f5695837e | [
"ECL-2.0"
] | null | null | null | coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-3_2-SCRIPT/mysql/dml/KC_DML_01_KCIRB-1470_B000.sql | smith750/kc | e411ed1a4f538a600e04f964a2ba347f5695837e | [
"ECL-2.0"
] | null | null | null | DELIMITER /
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '303', 'Withdraw Event', 'Protocol {PROTOCOL_NUMBER} Withdrawn', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Withdrawn" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Withdraw Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Withdraw Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '116', 'Notify Irb Event', 'Protocol {PROTOCOL_NUMBER} Notify Irb', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Notify Irb" performed on it.<br />The action was executed by {USER_FULLNAME}.<br />The Submission Type Qualifier is "{LAST_SUBMISSION_TYPE_QUAL_NAME}".<br />The Submission Review Type is "{PROTOCOL_REVIEW_TYPE_DESC}".<br />The Committee name is "{COMMITTEE_NAME}".<br />The comment on the action is "{ACTION_COMMENTS}".<br />Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Notify Irb Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Notify Irb Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '105', 'Request To Close Event', 'Protocol {PROTOCOL_NUMBER} Request To Close', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Request To Close" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Request To Close Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Request To Close Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '106', 'Request To Suspension Event', 'Protocol {PROTOCOL_NUMBER} Request To Suspension', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Request for suspension" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Request To Suspension Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Request To Suspension Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '108', 'Close Enrollment Event', 'Protocol {PROTOCOL_NUMBER} request to Close Enrollment', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Request To Close Enrollment" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Close Enrollment Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Close Enrollment Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '115', 'Re-Open Enrollment Event', 'Protocol {PROTOCOL_NUMBER} request to Re-Open Enrollment', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Request to re-open enrollment" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Re-Open Enrollment Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Re-Open Enrollment Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '114', 'Data Analysis Event', 'Protocol {PROTOCOL_NUMBER} request for Data Analysis', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Request For Data Analysis" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Data Analysis Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Data Analysis Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '119', 'Protocol Abandon Event', 'Protocol {PROTOCOL_NUMBER} Abandoned', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "Abandon" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Protocol Abandon Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Protocol Abandon Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '209', 'Irb Acknowledgement Event', 'Protocol {PROTOCOL_NUMBER} IRB Acknowledgement', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>, Principal Investigator {PI_NAME} has had the action "IRB Acknowledgement" performed on it.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Irb Acknowledgement Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Irb Acknowledgement Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '200', 'Assigned To Agenda Event', 'Protocol {PROTOCOL_NUMBER} assigned to agenda', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a> has been assigned to agenda.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Assigned To Agenda Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Assigned To Agenda Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Assigned To Agenda Event'), 'KC-PROTOCOL:Active Committee Member On Protocol', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '901', 'Assign Reviewer Event', 'IRB Protocol Reviewer {ACTION_TAKEN}', 'You can view this protocol <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a> through Kuali Coeus.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Assign Reviewer Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Assign Reviewer Event'), 'KC-PROTOCOL:IRB Online Reviewer', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '201', 'Defer Event', 'Protocol {PROTOCOL_NUMBER} Deferred', 'The IRB protocol <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a> (Principal Investigator {PI_NAME}) has been deferred.<br />The action was executed by {USER_FULLNAME}. Additional information and further actions can be accessed through the Kuali Coeus system.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Defer Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Defer Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '902', 'Review Complete Event', 'Protocol {PROTOCOL_NUMBER} Review Complete', '{USER_FULLNAME} has approved review comments for protocol <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a>', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Review Complete Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Review Complete Event'), 'KC-PROTOCOL:IRB Online Reviewer', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '203', 'Specific Minor Revisions Event', 'Specific minor revisions requested.', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a> has requested specific minor revisions.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Specific Minor Revisions Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Specific Minor Revisions Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), '7', '202', 'Substantive Revisions Required Event', 'Substantive revisions required.', 'The IRB protocol number <a title="" target="_self" href="../kew/DocHandler.do?command=displayDocSearchView&docId={DOCUMENT_NUMBER}">{PROTOCOL_NUMBER}</a> has requested substantive revisions.', 'N', 'Y', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Substantive Revisions Required Event'), 'KC-UNT:IRB Administrator', 'admin', NOW(), 1, UUID())
/
INSERT INTO SEQ_NOTIFICATION_TYPE_ID VALUES(NULL)
/
INSERT INTO NOTIFICATION_TYPE_RECIPIENT (NOTIFICATION_TYPE_RECIPIENT_ID, NOTIFICATION_TYPE_ID, ROLE_NAME, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM SEQ_NOTIFICATION_TYPE_ID), (SELECT NOTIFICATION_TYPE_ID FROM NOTIFICATION_TYPE WHERE DESCRIPTION = 'Substantive Revisions Required Event'), 'KC-PROTOCOL:PI', 'admin', NOW(), 1, UUID())
/
DELIMITER ;
| 104.682403 | 797 | 0.796318 |
87562110d28fef2ea71b8098700b6d8f2f19e1c0 | 4,143 | html | HTML | client/src/app/youtube/components/music-player/music-player.component.html | ggresillion/DiscordSoundBoard | d8537bd97f03e0a971622ebaaecc2149f4875d9a | [
"MIT"
] | 2 | 2018-04-01T11:54:25.000Z | 2019-04-02T17:11:41.000Z | client/src/app/youtube/components/music-player/music-player.component.html | ggresillion/DiscordSoundBoard | d8537bd97f03e0a971622ebaaecc2149f4875d9a | [
"MIT"
] | 28 | 2020-08-15T19:41:37.000Z | 2022-03-28T08:30:50.000Z | client/src/app/youtube/components/music-player/music-player.component.html | ggresillion/DiscordSoundBoard | d8537bd97f03e0a971622ebaaecc2149f4875d9a | [
"MIT"
] | null | null | null | <mat-card class="container" fxLayout="column" fxFlex>
<div class="player" fxLayout="column" fxLayoutGap="16px" fxFlex="25">
<div class="player-container">
<button mat-button (click)="stop()" style="border-left: 1px solid #ddd;"
[disabled]="status === 'na' || !playlist || playlist.length <= 0">
<mat-icon aria-hidden="true">stop</mat-icon>
</button>
<button mat-button (click)='playPause()' style="border-left: 2px solid #ccc; border-right: 2px solid #ccc;"
[disabled]="status === 'na' || status === 'loading' || !playlist || playlist.length <= 0">
<mat-icon *ngIf="status === 'loading'">
<mat-spinner diameter="24"></mat-spinner>
</mat-icon>
<mat-icon *ngIf="status !== 'playing' && status !== 'loading'">play_arrow</mat-icon>
<mat-icon *ngIf="status === 'playing'">pause</mat-icon>
</button>
<button mat-button style="border-right: 1px solid #ddd;" (click)='nextSong();'
[disabled]="!playlist || playlist.length <= 0 || status === 'na'">
<mat-icon aria-hidden="true">skip_next</mat-icon>
</button>
<div class="player-progress">
<span *ngIf="duration">{{currentTime | secondsToMinutes}}</span>
<mat-slider style="width: 100%" min="0" max="{{duration}}" value="{{currentTime}}" disabled></mat-slider>
<span *ngIf="duration">-{{duration - currentTime | secondsToMinutes }}</span>
</div>
</div>
<div class="current-song" fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px"
*ngIf="displayTitle && playlist && !!playlist[0]; else noTrack">
<app-youtube-thumbnail [link]="playlist[0].thumbnail"></app-youtube-thumbnail>
<div>
<span class="mat-h2">{{ playlist[0].title }}</span>
<span> - </span>
<span class="mat-h3">{{ playlist[0].author.name }}</span>
</div>
</div>
<ng-template #noTrack>
<div class="no-music" fxLayout="row" fxLayoutAlign="center center">
<span class="mat-h4">No music playing.</span>
</div>
</ng-template>
</div>
<div class="playlist" fxLayout="column" fxLayoutAlign="space-between" fxFlex="30">
<div fxLayout="column" fxFlex>
<h2>Playlist</h2>
<table class="track" mat-table [dataSource]="dataSource" *ngIf="playlist && dataSource.data.length > 0">
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef>#</th>
<td mat-cell *matCellDef="let element;">
{{getTrackPosition(element)}}
</td>
</ng-container>
<ng-container matColumnDef="thumbnail">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element" fxLayout="row" fxLayoutAlign="center center">
<app-youtube-thumbnail [link]="element.thumbnail"></app-youtube-thumbnail>
</td>
</ng-container>
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef> Title</th>
<td mat-cell *matCellDef="let element">
{{element.title}}
<div class="actions">
<mat-icon [class.disabled]="!(getIndex(element) > 1)" matTooltip="Move upwards"
(click)="moveUpwards(element)">
arrow_upwards</mat-icon>
<mat-icon [class.disabled]="!(getIndex(element) < playlist.length - 1)" matTooltip="Move downwards"
(click)="moveDownwards(element)">arrow_downwards</mat-icon>
<mat-icon matTooltip="Remove from playlist" (click)="removeFromPlaylist(element)">delete_outline
</mat-icon>
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<div *ngIf="!playlist || dataSource.data.length === 0" fxLayout="row" fxLayoutAlign="center" fxFlex>
<span>No music in the playlist.</span>
</div>
</div>
<mat-paginator [pageSizeOptions]="pageSizeOptions" showFirstLastButtons></mat-paginator>
</div>
</mat-card> | 49.321429 | 113 | 0.598117 |
68775b78b55afc71fc7f22d37cb146aa874873e1 | 3,878 | sql | SQL | route_permissions_data-1.sql | Wagebelu44/Lawportal | 88c9f81fec0e95d93c97a72ac06cf1fa806a150d | [
"MIT"
] | null | null | null | route_permissions_data-1.sql | Wagebelu44/Lawportal | 88c9f81fec0e95d93c97a72ac06cf1fa806a150d | [
"MIT"
] | null | null | null | route_permissions_data-1.sql | Wagebelu44/Lawportal | 88c9f81fec0e95d93c97a72ac06cf1fa806a150d | [
"MIT"
] | null | null | null |
insert into `route_permissions`(`id`,`permission_id`,`route_name`,`master_type`) values
(1,5,'user.index',NULL),
(2,5,'user.show',NULL),
(3,6,'user.edit',NULL),
(4,6,'user.update',NULL),
(5,7,'user.destroy',NULL),
(6,8,'userrole.index',NULL),
(7,8,'userrole.show',NULL),
(8,9,'userrole.edit',NULL),
(9,9,'userrole.update',NULL),
(10,10,'userrole.destroy',NULL),
(11,11,'attendence',NULL),
(12,11,'attendence_logs',NULL),
(13,17,'user.create',NULL),
(14,17,'user.store',NULL),
(15,53,'userrole.create',NULL),
(16,53,'userrole.store',NULL),
(17,12,'master.index','revision'),
(18,12,'master.show','revision'),
(19,13,'master.index','court'),
(20,13,'master.show','court'),
(21,14,'master.create','court'),
(22,14,'master.store','court'),
(23,15,'master.edit','court'),
(24,15,'master.update','court'),
(25,16,'master.destroy','court'),
(26,18,'master.index','state'),
(27,18,'master.show','state'),
(28,19,'master.create','state'),
(29,19,'master.store','state'),
(30,20,'master.edit','state'),
(31,20,'master.update','state'),
(32,21,'master.destroy','state'),
(33,22,'master.index','case'),
(34,22,'master.show','case'),
(35,23,'master.create','case'),
(36,23,'master.store','case'),
(37,24,'master.edit','case'),
(38,24,'master.update','case'),
(39,25,'master.destroy','case'),
(40,26,'master.index','case_category'),
(41,26,'master.show','case_category'),
(42,27,'master.create','case_category'),
(43,27,'master.store','case_category'),
(44,28,'master.edit','case_category'),
(45,28,'master.update','case_category'),
(46,29,'master.destroy','case_category'),
(47,30,'master.index','todo'),
(48,30,'master.show','todo'),
(49,31,'master.create','todo'),
(50,31,'master.store','todo'),
(51,32,'master.edit','todo'),
(52,32,'master.update','todo'),
(53,33,'master.destroy','todo'),
(54,34,'master.index','holiday'),
(55,34,'master.show','holiday'),
(56,35,'master.create','holiday'),
(57,35,'master.store','holiday'),
(58,36,'master.edit','holiday'),
(59,36,'master.update','holiday'),
(60,37,'master.destroy','holiday'),
(61,38,'master.index','evaluation'),
(62,38,'master.show','evaluation'),
(63,39,'master.create','evaluation'),
(64,39,'master.store','evaluation'),
(65,40,'master.edit','evaluation'),
(66,40,'master.update','evaluation'),
(67,41,'master.destroy','evaluation'),
(68,42,'master.index','incident'),
(69,42,'master.show','incident'),
(70,43,'master.create','incident'),
(71,43,'master.store','incident'),
(72,44,'master.edit','incident'),
(73,44,'master.update','incident'),
(74,45,'master.destroy','incident'),
(75,46,'todo_list',NULL),
(76,46,'mytodo',NULL),
(77,47,'change.todo_status',NULL),
(78,48,'add.todo.comment',NULL),
(79,48,'delete_todo_comment',NULL),
(80,48,'update_todo_comment',NULL),
(81,49,'incident_list',NULL),
(82,49,'myincident',NULL),
(83,50,'add.incident.comment',NULL),
(84,50,'update_incident_comment',NULL),
(85,50,'delete_incident_comment',NULL),
(86,51,'user_evaluation',NULL),
(87,51,'evaluation',NULL),
(88,52,'evaluation_review',NULL),
(91,16,'master.bulk.delete','court'),
(92,21,'master.bulk.delete','state'),
(93,25,'master.bulk.delete','case'),
(94,29,'master.bulk.delete','case_category'),
(95,33,'master.bulk.delete','todo'),
(96,37,'master.bulk.delete','holiday'),
(97,41,'master.bulk.delete','evaluation'),
(98,45,'master.bulk.delete','incident'),
(99,54,'master.index','file_manager'),
(100,54,'master.show','file_manager'),
(101,55,'master.create','file_manager'),
(102,55,'master.store','file_manager'),
(103,56,'master.edit','file_manager'),
(104,56,'master.update','file_manager'),
(105,57,'master.destroy','file_manager'),
(106,58,'master.index','file_location'),
(107,58,'master.show','file_location'),
(108,59,'master.create','file_location'),
(109,59,'master.store','file_location'),
(110,60,'master.edit','file_location'),
(111,60,'master.update','file_location'),
(112,61,'master.destroy','file_location');
| 34.017544 | 89 | 0.669933 |
2f48c731a8f955ce680b6ba8b51f300be7c5d823 | 170 | sql | SQL | oci-test/tests/oci_autoscaling_auto_scaling_configuration/test-get-query.sql | turbot/steampipe-plugin-oci | cd534d4992835eb1c756ea93d54ed1a653f7874a | [
"Apache-2.0"
] | 14 | 2021-04-08T08:15:06.000Z | 2022-03-23T16:07:49.000Z | oci-test/tests/oci_autoscaling_auto_scaling_configuration/test-get-query.sql | turbot/steampipe-plugin-oci | cd534d4992835eb1c756ea93d54ed1a653f7874a | [
"Apache-2.0"
] | 235 | 2021-04-02T14:39:36.000Z | 2022-03-30T12:44:35.000Z | oci-test/tests/oci_autoscaling_auto_scaling_configuration/test-get-query.sql | turbot/steampipe-plugin-oci | cd534d4992835eb1c756ea93d54ed1a653f7874a | [
"Apache-2.0"
] | null | null | null | select id, display_name, is_enabled, cool_down_in_seconds, freeform_tags
from oci.oci_autoscaling_auto_scaling_configuration
where id = '{{ output.resource_id.value }}'; | 56.666667 | 73 | 0.829412 |
53f7c2cb0d73acfe78bdcc5575168f0750402939 | 4,999 | swift | Swift | WeatherApp/WeatherApp/Controller/CurrentWeatherViewController.swift | PavitraHegde/WeatherApp | c3db0aa221922c6778f0023f9902db8654650d75 | [
"MIT"
] | null | null | null | WeatherApp/WeatherApp/Controller/CurrentWeatherViewController.swift | PavitraHegde/WeatherApp | c3db0aa221922c6778f0023f9902db8654650d75 | [
"MIT"
] | null | null | null | WeatherApp/WeatherApp/Controller/CurrentWeatherViewController.swift | PavitraHegde/WeatherApp | c3db0aa221922c6778f0023f9902db8654650d75 | [
"MIT"
] | null | null | null | //
// CurrentWeatherViewController.swift
// WeatherApp
//
// Created by Pavitra on 14/08/20.
// Copyright © 2020 Pavitra Hegde. All rights reserved.
//
import UIKit
class CurrentWeatherViewController: UIViewController {
@IBOutlet weak var celsius: UIButton!
@IBOutlet weak var tableFooterView: UIView!
@IBOutlet weak var farhenheit: UIButton!
@IBOutlet weak var tableView: UITableView!
private let weatherService = WeatherService()
private var weatherList = [Weather]() {
didSet {
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
}
private var curentTempFormat: Weather.TemperatureFormat = .celsius {
didSet {
self.tableView.reloadData()
}
}
//MARK:- View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
self.initialSetup()
fetchWeatherList(shouldFetchLatestWeatherInfo: true)
}
//MARK:- IBAction methods
@IBAction func celsiusButtonTapped(_ sender: UIButton) {
celsius.setTitleColor(.white, for: .normal)
farhenheit.setTitleColor(.gray, for: .normal)
curentTempFormat = .celsius
}
@IBAction func farhenheitButtonTapped(_ sender: UIButton) {
farhenheit.setTitleColor(.white, for: .normal)
celsius.setTitleColor(.gray, for: .normal)
curentTempFormat = .farhenheit
}
@IBAction func didSelectCity(_ unwindSegue: UIStoryboardSegue) {
let sourceViewController = unwindSegue.source as! SearchCityViewController
if let searchedItem = sourceViewController.selectedSearchItem {
fetchWeatherInfo(selectedCity: searchedItem)
}
}
}
extension CurrentWeatherViewController {
func fetchWeatherList(shouldFetchLatestWeatherInfo: Bool) {
let moc = AppDelegate.shared.persistentContainer.viewContext
weatherList = Weather.fetchCurrentWeatherList(context: moc)
guard shouldFetchLatestWeatherInfo, weatherList.count > 0 else {
return
}
fetchUpdatedWeatherList(cityIdList: weatherList.map{$0.cityId.description})
}
func fetchUpdatedWeatherList(cityIdList: [String]) {
weatherService.getCurrentWeatherListByCityIds(cityIdList) { (error, response) in
if let error = error {
print(error)
} else {
self.fetchWeatherList(shouldFetchLatestWeatherInfo: false)
}
}
}
}
//MARK:- TableView DataSource methods
extension CurrentWeatherViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return weatherList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CurrentWeatherTableViewCell", for: indexPath) as! CurrentWeatherTableViewCell
let weatherData = weatherList[indexPath.row]
cell.cityName.text = weatherData.name
if let temperature = weatherData.getFormattedTemperature(format: curentTempFormat) {
let tempFormatted = String(format:"\(temperature)%@", "\u{00B0}")
cell.temp.text = tempFormatted
} else {
cell.temp.text = "No data"
}
cell.time.text = weatherData.getFormattedDate()
return cell
}
}
//MARK:- TableView Delegate methods
extension CurrentWeatherViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "WeatherForecastViewController", sender: nil)
}
}
extension CurrentWeatherViewController {
func initialSetup() {
let nib = UINib(nibName: "CurrentWeatherTableViewCell", bundle: nil)
tableView.register(nib, forCellReuseIdentifier: "CurrentWeatherTableViewCell")
tableView.tableFooterView = tableFooterView
}
}
extension CurrentWeatherViewController {
private func fetchWeatherInfo(selectedCity: SearchResponse) {
fetchCurrentWeatherInfo(lat: selectedCity.lat, lon: selectedCity.lon)
fetchWeatherForecast(lat: selectedCity.lat, lon: selectedCity.lon)
}
private func fetchCurrentWeatherInfo(lat: String, lon: String) {
weatherService.getCurrentWeather(latitude: lat, longitude: lon) { (error, weather) in
if let error = error {
print(error)
} else {
self.weatherList.append(weather!)
}
}
}
private func fetchWeatherForecast(lat: String, lon: String) {
weatherService.getWeatherForecast(latitude: lat, longitude: lon) { (error, weatherForecast) in
if let error = error {
print(error)
} else {
}
}
}
}
| 33.10596 | 143 | 0.655331 |
409a98ce5c5008b20eff41e1595fb9e92baf9d12 | 2,524 | py | Python | userbot/modules/asupan.py | Yansaii/Bdrl-Ubot | 60dbbcc8270061379e848c2bce09e756c6ae143a | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/asupan.py | Yansaii/Bdrl-Ubot | 60dbbcc8270061379e848c2bce09e756c6ae143a | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/asupan.py | Yansaii/Bdrl-Ubot | 60dbbcc8270061379e848c2bce09e756c6ae143a | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | # 🍀 © @tofik_dn
# ⚠️ Do not remove credits
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP
from userbot.utils import bdrl_cmd
import random
from userbot import owner
from telethon.tl.types import InputMessagesFilterVideo
from telethon.tl.types import InputMessagesFilterVoice
@bdrl_cmd(pattern="asupan$")
async def _(event):
try:
asupannya = [
asupan
async for asupan in event.client.iter_messages(
"@punyakenkan", filter=InputMessagesFilterVideo
)
]
aing = await event.client.get_me()
await event.client.send_file(
event.chat_id,
file=random.choice(asupannya),
caption=f"Nih kak asupannya [{owner}](tg://user?id={aing.id})",
)
await event.delete()
except Exception:
await event.edit("Tidak bisa menemukan video asupan.")
@bdrl_cmd(pattern="desah$")
async def _(event):
try:
desahnya = [
desah
async for desah in event.client.iter_messages(
"@punyakenkan", filter=InputMessagesFilterVoice
)
]
aing = await event.client.get_me()
await event.client.send_file(
event.chat_id,
file=random.choice(desahnya),
caption=f"Nih kak desahannya [{owner}](tg://user?id={aing.id})",
)
await event.delete()
except Exception:
await event.edit("Tidak bisa menemukan desahan.")
@bdrl_cmd(pattern="bokep$")
async def _(event):
try:
asupannya = [
asupan
async for asupan in event.client.iter_messages(
"@bkpdappa", filter=InputMessagesFilterVideo
)
]
aing = await event.client.get_me()
await event.client.send_file(
event.chat_id,
file=random.choice(asupannya),
caption=f"Nih kak bokepnya [{owner}](tg://user?id={aing.id})",
)
await event.delete()
except Exception:
await event.edit("Tidak bisa menemukan video bokep.")
CMD_HELP.update(
{
"asupan": f"**Plugin : **`asupan`\
\n\n • **Syntax :** `{cmd}asupan`\
\n • **Function : **Untuk Mengirim video asupan secara random.\
\n\n • **Syntax :** `{cmd}desah`\
\n • **Function : **Untuk Mengirim voice desah secara random.\
\n\n • **Syntax :** `{cmd}bokep`\
\n • **Function : **Untuk Mengirim video bokep secara random.\
"
}
)
| 30.047619 | 76 | 0.578843 |
6aae1a5f7117944485b3c81a2aeee8f4c938a4ef | 6,352 | asm | Assembly | src/shaders/post_processing/gen5_6/Common/YUV_to_RGBX_Coef.asm | me176c-dev/android_hardware_intel-vaapi-driver | 0f2dca8d604220405e4678c0b6c4faa578d994ec | [
"MIT"
] | 192 | 2018-01-26T11:51:55.000Z | 2022-03-25T20:04:19.000Z | src/shaders/post_processing/gen5_6/Common/YUV_to_RGBX_Coef.asm | me176c-dev/android_hardware_intel-vaapi-driver | 0f2dca8d604220405e4678c0b6c4faa578d994ec | [
"MIT"
] | 256 | 2017-01-23T02:10:27.000Z | 2018-01-23T10:00:05.000Z | src/shaders/post_processing/gen5_6/Common/YUV_to_RGBX_Coef.asm | me176c-dev/android_hardware_intel-vaapi-driver | 0f2dca8d604220405e4678c0b6c4faa578d994ec | [
"MIT"
] | 64 | 2018-01-30T19:51:53.000Z | 2021-11-24T01:26:14.000Z | /*
* All Video Processing kernels
* Copyright © <2010>, Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This file was originally licensed under the following license
*
* 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.
*
* Authors:
* Halley Zhao <halley.zhao@intel.com>
*/
// Module name: YUV_to_RGBX_Coef.asm
//----------------------------------------------------------------
#define ubDEST_RGBX ubTOP_Y // I'd like use them for color conversion
// is dst surface |R|G|B|X| layout? otherwise, it is |B|G|R|X| layout
and.nz.f0.1 (1) dNULLREG r1.2:ud 0xFF000000:ud
#ifdef FIX_POINT_CONVERSION
// ###### set up transformation coefficient
// R = clip(( 298 * C + 0 * D + 409 * E + 128) >> 8)
// R = clip((0x012A * C + 0 * D + 0x0199 * E + 128) >> 8)
(-f0.1) mov (1) REG2(r, nTEMP0, 0):ud 0x0000012A:ud
(-f0.1) mov (1) REG2(r, nTEMP0, 1):ud 0x00000199:ud
( f0.1) mov (1) REG2(r, nTEMP0, 4):ud 0x0000012A:ud
( f0.1) mov (1) REG2(r, nTEMP0, 5):ud 0x00000199:ud
// G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8)
// G = clip(( 0x012A * C - 0x64 * D - 0xD0 * E + 128) >> 8)
// G = clip(( 0x012A * C + 0xFF9C * D + 0xFF30 * E + 128) >> 8)
mov (1) REG2(r, nTEMP0, 2):ud 0xFF9C012A:ud
mov (1) REG2(r, nTEMP0, 3):ud 0x0000FF30:ud
// B = clip(( 298 * C + 516 * D + 0 * E + 128) >> 8)
// B = clip((0x012A* C + 0x0204 * D + 0 * E + 128) >> 8)
(-f0.1) mov (1) REG2(r, nTEMP0, 4):ud 0x0204012A:ud
(-f0.1) mov (1) REG2(r, nTEMP0, 5):ud 0x00000000:ud
( f0.1) mov (1) REG2(r, nTEMP0, 0):ud 0x0204012A:ud
( f0.1) mov (1) REG2(r, nTEMP0, 1):ud 0x00000000:ud
// asr.sat (24) REG2(r,nTEMP0,0)<1> REG2(r,nTEMP0,0)<0;24,1> 1:w
asr.sat (8) REG2(r,nTEMP0, 0)<1>:w REG2(r,nTEMP0, 0)<0;8,1>:w 1:w
asr.sat (4) REG2(r,nTEMP0,8)<1>:w REG2(r,nTEMP0,8)<0;4,1>:w 1:w
// C = Y' - 16 D = U - 128 E = V - 128
mov (1) REG2(r, nTEMP0, 6):ud 0x008080F0:ud
#define wYUV_to_RGB_CH2_Coef_Fix REG2(r, nTEMP0, 0)
#define wYUV_to_RGB_CH1_Coef_Fix REG2(r, nTEMP0, 4)
#define wYUV_to_RGB_CH0_Coef_Fix REG2(r, nTEMP0, 8)
#define bYUV_OFF REG2(r,nTEMP0,24)
// debug use
#define bYUV_to_RGB_CH2_Coef_Fix REG2(r, nTEMP0, 0)
#define bYUV_to_RGB_CH1_Coef_Fix REG2(r, nTEMP0, 8)
#define bYUV_to_RGB_CH0_Coef_Fix REG2(r, nTEMP0, 16)
#else
// R = Y + 1.13983*V
// R = clip( Y + 1.402*(Cr-128)) // ITU-R
(-f0.1) mov (1) REG2(r, nTEMP8, 3):f 0.000f // A coef
(-f0.1) mov (1) REG2(r, nTEMP8, 2):f 1.402f // V coef
(-f0.1) mov (1) REG2(r, nTEMP8, 1):f 0.0f // U coef
(-f0.1) mov (1) REG2(r, nTEMP8, 0):f 1.0f // Y coef
( f0.1) mov (1) REG2(r, nTEMP10, 3):f 0.000f // A coef
( f0.1) mov (1) REG2(r, nTEMP10, 2):f 1.402f // V coef
( f0.1) mov (1) REG2(r, nTEMP10, 1):f 0.0f // U coef
( f0.1) mov (1) REG2(r, nTEMP10, 0):f 1.0f // Y coef
// G = Y - 0.39465*U - 0.58060*V
// G = clip( Y - 0.344*(Cb-128) - 0.714*(Cr-128))
mov (1) REG2(r, nTEMP8, 7):f 0.000f // A coef
mov (1) REG2(r, nTEMP8, 6):f -0.714f // V coef
mov (1) REG2(r, nTEMP8, 5):f -0.344f // U coef
mov (1) REG2(r, nTEMP8, 4):f 1.0f // Y coef
// B = Y + 2.03211*U
// B = clip( Y + 1.772*(Cb-128))
(-f0.1) mov (1) REG2(r, nTEMP10, 3):f 0.000f // A coef
(-f0.1) mov (1) REG2(r, nTEMP10, 2):f 0.0f // V coef
(-f0.1) mov (1) REG2(r, nTEMP10, 1):f 1.772f // U coef
(-f0.1) mov (1) REG2(r, nTEMP10, 0):f 1.0f // Y coef
( f0.1) mov (1) REG2(r, nTEMP8, 3):f 0.000f // A coef
( f0.1) mov (1) REG2(r, nTEMP8, 2):f 0.0f // V coef
( f0.1) mov (1) REG2(r, nTEMP8, 1):f 1.772f // U coef
( f0.1) mov (1) REG2(r, nTEMP8, 0):f 1.0f // Y coef
mov (1) REG2(r, nTEMP10, 4):ud 0x008080F0:ud
#define fYUV_to_RGB_CH2_Coef_Float REG2(r, nTEMP8, 0)
#define fYUV_to_RGB_CH1_Coef_Float REG2(r, nTEMP8, 4)
#define fYUV_to_RGB_CH0_Coef_Float REG2(r, nTEMP10, 0)
#define bYUV_OFF REG2(r,nTEMP10,16)
.declare fROW_YUVA Base=REG(r,nTEMP0) ElementSize=4 SrcRegion=REGION(8,8) Type=f // r nTEMP0 - r nTEMP7
#endif
| 48.861538 | 116 | 0.553999 |
6fda7765519e83628c47b1e1b61a19a08099e6ae | 21,325 | rs | Rust | src/bin/fluorite-gui.rs | LunarTulip/fluorite | 8e507039dd2e11f6d2286c5d8a17ce69ca09605e | [
"MIT"
] | null | null | null | src/bin/fluorite-gui.rs | LunarTulip/fluorite | 8e507039dd2e11f6d2286c5d8a17ce69ca09605e | [
"MIT"
] | null | null | null | src/bin/fluorite-gui.rs | LunarTulip/fluorite | 8e507039dd2e11f6d2286c5d8a17ce69ca09605e | [
"MIT"
] | null | null | null | #![windows_subsystem = "windows"]
use druid::commands::QUIT_APP;
use druid::keyboard_types::Key;
use druid::text::format::{Formatter, Validation, ValidationError};
use druid::text::selection::Selection;
use druid::widget::prelude::*;
use druid::widget::{Align, Button, Controller, Flex, Label, LineBreaking, List, Padding, Scroll, SizedBox, Split, TextBox, ValueTextBox};
use druid::{AppLauncher, Command, Data, Lens, LocalizedString, MenuDesc, MenuItem, Selector, Target, Widget, WidgetExt, WindowDesc};
use fluorite::parse::{clean_input, get_last_input, parse_input, RollInformation, Rule, VALID_INPUT_CHARS};
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::env::current_exe;
use std::error::Error;
use std::fs::{create_dir_all, read_to_string, write};
use std::path::PathBuf;
use std::sync::Arc;
////////////////
// Consts //
////////////////
lazy_static! {
static ref DATA_DIR: PathBuf = {
let mut path = current_exe().unwrap(); // Replace with real error-handling
path.pop();
path.push("fluorite_data");
path
};
static ref CONFIG_PATH: PathBuf = {
let mut path = DATA_DIR.clone();
path.push("config.json");
path
};
static ref HISTORY_PATH: PathBuf = {
let mut path = DATA_DIR.clone();
path.push("history.json");
path
};
static ref SHORTCUTS_PATH: PathBuf = {
let mut path = DATA_DIR.clone();
path.push("shortcuts.json");
path
};
}
/////////////////
// Structs //
/////////////////
#[derive(Clone, Data, Deserialize, Serialize)]
struct DiceCalculatorConfig {
max_history_entries: u64,
save_history: bool,
save_shortcuts: bool,
}
impl DiceCalculatorConfig {
fn new() -> DiceCalculatorConfig {
DiceCalculatorConfig {
max_history_entries: 100,
save_history: true,
save_shortcuts: true,
}
}
}
enum CalcButton {
Zero,
One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Decimal,
D4,
D6,
D8,
D10,
D12,
D20,
Plus,
Minus,
Times,
Divide,
Mod,
Dice,
OpenParen,
CloseParen,
ClearEntry,
Clear,
Backspace,
Roll,
PlaceholderNotCurrentlyInUse,
}
#[derive(Clone, Data, Deserialize, Serialize)]
struct RollShortcut {
name: String,
roll: String,
}
#[derive(Clone, Data, Lens)]
struct DiceCalculator {
config: DiceCalculatorConfig,
current_input: String,
stored_input: String,
history: Arc<Vec<(String, Result<RollInformation, String>)>>,
steps_back_in_history: usize,
shortcuts: Arc<Vec<RollShortcut>>,
new_shortcut_name: String,
new_shortcut_text: String,
}
impl DiceCalculator {
fn new(config: DiceCalculatorConfig) -> DiceCalculator {
DiceCalculator {
config: config.clone(),
current_input: String::new(),
stored_input: String::new(),
history: match config.save_history {
true => load_history(),
false => Arc::new(Vec::new()),
},
steps_back_in_history: 0,
shortcuts: match config.save_history {
true => load_shortcuts(),
false => Arc::new(Vec::new()),
},
new_shortcut_name: String::new(),
new_shortcut_text: String::new(),
}
}
fn add_to_history(&mut self, input: String, output: Result<RollInformation, String>) {
let history = Arc::make_mut(&mut self.history);
history.push((input, output));
while history.len() as u64 > self.config.max_history_entries {
let _ = history.drain(0..1);
}
if self.config.save_history {
save_history(&self);
}
}
fn roll(&mut self) {
if !self.current_input.is_empty() {
self.add_to_history(self.current_input.clone(), parse_input(&self.current_input));
self.current_input = String::new();
self.stored_input = String::new();
self.steps_back_in_history = 0;
}
}
fn roll_from_shortcut(&mut self, shortcut: &RollShortcut) {
self.add_to_history(shortcut.roll.clone(), parse_input(&shortcut.roll));
if self.steps_back_in_history != 0 {
self.current_input = self.stored_input.clone()
}
self.steps_back_in_history = 0;
}
fn add_shortcut(_ctx: &mut EventCtx, data: &mut Self, _env: &Env) {
let new_shortcut = RollShortcut {
name: data.new_shortcut_name.clone(),
roll: data.new_shortcut_text.clone(),
};
if !data.shortcuts.iter().any(|shortcut| shortcut.name == new_shortcut.name || new_shortcut.name == "") {
Arc::make_mut(&mut data.shortcuts).insert(0, new_shortcut);
data.new_shortcut_name = String::new();
data.new_shortcut_text = String::new();
}
if data.config.save_shortcuts {
save_shortcuts(&data);
}
}
}
struct DiceCalcEventHandler;
impl<W: Widget<DiceCalculator>> Controller<DiceCalculator, W> for DiceCalcEventHandler {
fn event(&mut self, child: &mut W, ctx: &mut EventCtx, event: &Event, data: &mut DiceCalculator, env: &Env) {
match event {
Event::WindowConnected => ctx.request_focus(),
Event::MouseDown(_) => ctx.request_focus(),
Event::KeyDown(key_event) if ctx.is_focused() => match &key_event.key {
Key::Character(s) => {
if VALID_INPUT_CHARS.contains(s) {
if s == " " {
if !data.current_input.is_empty() {
data.current_input.push_str(&s)
}
} else {
data.current_input.push_str(&s);
}
}
}
Key::Backspace => {
let _ = data.current_input.pop();
}
Key::ArrowUp => {
let history_len = data.history.len();
if data.steps_back_in_history < history_len {
if data.steps_back_in_history == 0 {
data.stored_input = data.current_input.clone();
}
data.steps_back_in_history += 1;
data.current_input = data.history[history_len - data.steps_back_in_history].0.clone();
}
}
Key::ArrowDown => {
if data.steps_back_in_history > 0 {
data.steps_back_in_history -= 1;
data.current_input = if data.steps_back_in_history == 0 {
data.stored_input.clone()
} else {
data.history[data.history.len() - data.steps_back_in_history].0.clone()
}
}
}
Key::Enter => data.roll(),
_ => (),
},
Event::Command(command) => {
if command.is::<RollShortcut>(Selector::new("ShortcutRoll")) {
let shortcut = &command.get_unchecked::<RollShortcut>(Selector::new("ShortcutRoll"));
data.roll_from_shortcut(shortcut);
} else if command.is::<RollShortcut>(Selector::new("ShortcutDelete")) {
let name_to_delete = command.get_unchecked::<RollShortcut>(Selector::new("ShortcutDelete")).name.clone();
Arc::make_mut(&mut data.shortcuts).retain(|shortcut| shortcut.name != name_to_delete);
if data.config.save_shortcuts {
save_shortcuts(&data);
}
}
}
_ => (),
}
child.event(ctx, event, data, env);
}
}
#[derive(Debug)]
struct FormatValidationError;
impl std::fmt::Display for FormatValidationError {
// Ugly hack; build a real implementation.
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Ok(())
}
}
impl Error for FormatValidationError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
None
}
}
struct DiceTextFormatter;
impl Formatter<String> for DiceTextFormatter {
fn format(&self, value: &String) -> String {
value.clone()
}
fn validate_partial_input(&self, input: &str, _sel: &Selection) -> Validation {
let input_cleaned = clean_input(input);
if &input_cleaned == input {
Validation::success()
} else {
Validation::failure(FormatValidationError {}).change_text(input_cleaned)
}
}
fn value(&self, input: &str) -> Result<String, ValidationError> {
Ok(String::from(input))
}
}
//////////////////////////
// Helper Functions //
//////////////////////////
fn ensure_data_dir_exists() {
if !DATA_DIR.as_path().exists() {
create_dir_all(&*DATA_DIR).unwrap()
}
}
fn load_config() -> DiceCalculatorConfig {
match read_to_string(&*CONFIG_PATH) {
Ok(config_as_json) => match serde_json::from_str(&config_as_json) {
Ok(config) => config,
Err(_) => DiceCalculatorConfig::new(),
},
Err(_) => DiceCalculatorConfig::new(),
}
}
fn load_history() -> Arc<Vec<(String, Result<RollInformation, String>)>> {
match read_to_string(&*HISTORY_PATH) {
Ok(history_as_json) => match serde_json::from_str(&history_as_json) {
Ok(history) => history,
Err(_) => Arc::new(Vec::new()),
},
Err(_) => Arc::new(Vec::new()),
}
}
fn load_shortcuts() -> Arc<Vec<RollShortcut>> {
match read_to_string(&*SHORTCUTS_PATH) {
Ok(shortcuts_as_json) => match serde_json::from_str(&shortcuts_as_json) {
Ok(shortcuts) => shortcuts,
Err(_) => Arc::new(Vec::new()),
},
Err(_) => Arc::new(Vec::new()),
}
}
fn save_config(calc: &DiceCalculator) {
ensure_data_dir_exists();
let config_as_json = serde_json::to_string(&calc.config).unwrap();
write(&*CONFIG_PATH, config_as_json).unwrap();
}
fn save_history(calc: &DiceCalculator) {
ensure_data_dir_exists();
let history_as_json = serde_json::to_string(&calc.history).unwrap();
write(&*HISTORY_PATH, history_as_json).unwrap();
}
fn save_shortcuts(calc: &DiceCalculator) {
ensure_data_dir_exists();
let shortcuts_as_json = serde_json::to_string(&calc.shortcuts).unwrap();
write(&*SHORTCUTS_PATH, shortcuts_as_json).unwrap();
}
//////////////////////
// GUI Assembly //
//////////////////////
fn build_calc_button(button: CalcButton, label: &str) -> impl Widget<DiceCalculator> {
SizedBox::new(Label::new(label).center())
.width(100.)
.height(100.)
.on_click(move |_ctx, data: &mut DiceCalculator, _env| match button {
CalcButton::Zero => data.current_input.push('0'),
CalcButton::One => data.current_input.push('1'),
CalcButton::Two => data.current_input.push('2'),
CalcButton::Three => data.current_input.push('3'),
CalcButton::Four => data.current_input.push('4'),
CalcButton::Five => data.current_input.push('5'),
CalcButton::Six => data.current_input.push('6'),
CalcButton::Seven => data.current_input.push('7'),
CalcButton::Eight => data.current_input.push('8'),
CalcButton::Nine => data.current_input.push('9'),
CalcButton::Decimal => data.current_input.push('.'),
CalcButton::D4 => match get_last_input(&data.current_input).1 {
Some(rule) if rule == Rule::number => data.current_input.push_str("d4"),
_ => data.current_input.push_str("1d4"),
}
CalcButton::D6 => match get_last_input(&data.current_input).1 {
Some(rule) if rule == Rule::number => data.current_input.push_str("d6"),
_ => data.current_input.push_str("1d6"),
}
CalcButton::D8 => match get_last_input(&data.current_input).1 {
Some(rule) if rule == Rule::number => data.current_input.push_str("d8"),
_ => data.current_input.push_str("1d8"),
}
CalcButton::D10 => match get_last_input(&data.current_input).1 {
Some(rule) if rule == Rule::number => data.current_input.push_str("d10"),
_ => data.current_input.push_str("1d10"),
}
CalcButton::D12 => match get_last_input(&data.current_input).1 {
Some(rule) if rule == Rule::number => data.current_input.push_str("d12"),
_ => data.current_input.push_str("1d12"),
}
CalcButton::D20 => match get_last_input(&data.current_input).1 {
Some(rule) if rule == Rule::number => data.current_input.push_str("d20"),
_ => data.current_input.push_str("1d20"),
}
CalcButton::Plus => data.current_input.push('+'),
CalcButton::Minus => data.current_input.push('-'),
CalcButton::Times => data.current_input.push('*'),
CalcButton::Divide => data.current_input.push('/'),
CalcButton::Mod => data.current_input.push('%'),
CalcButton::Dice => data.current_input.push('d'),
CalcButton::OpenParen => data.current_input.push('('),
CalcButton::CloseParen => data.current_input.push(')'),
CalcButton::ClearEntry => {
let last_input = get_last_input(&data.current_input).0;
for _ in 0..last_input.len() {
let _ = data.current_input.pop();
}
}
CalcButton::Clear => data.current_input = String::new(),
CalcButton::Backspace => {
let _ = data.current_input.pop();
}
CalcButton::Roll => if !data.current_input.is_empty() {
data.roll()
}
CalcButton::PlaceholderNotCurrentlyInUse => (),
})
}
fn build_current_input_display() -> impl Widget<DiceCalculator> {
Padding::new((30., 0.),
Align::right(
Label::<DiceCalculator>::dynamic(|calc, _env| if calc.current_input.is_empty() { String::from("Roll text") } else { String::from(&calc.current_input) }).with_text_size(50.).with_line_break_mode(LineBreaking::Clip)
)
)
}
fn build_main_calculator_display() -> impl Widget<DiceCalculator> {
Flex::column()
.with_flex_child(
Flex::row()
.with_child(build_calc_button(CalcButton::D20, "d20"))
.with_child(build_calc_button(CalcButton::ClearEntry, "CE"))
.with_child(build_calc_button(CalcButton::Clear, "C"))
.with_child(build_calc_button(CalcButton::Backspace, "[Backspace]"))
.with_child(build_calc_button(CalcButton::Dice, "d")),
1.,
)
.with_flex_child(
Flex::row()
.with_child(build_calc_button(CalcButton::D12, "d12"))
.with_child(build_calc_button(CalcButton::OpenParen, "("))
.with_child(build_calc_button(CalcButton::CloseParen, ")"))
.with_child(build_calc_button(CalcButton::Mod, "%"))
.with_child(build_calc_button(CalcButton::Divide, "[Divide]")),
1.,
)
.with_flex_child(
Flex::row()
.with_child(build_calc_button(CalcButton::D10, "d10"))
.with_child(build_calc_button(CalcButton::Seven, "7"))
.with_child(build_calc_button(CalcButton::Eight, "8"))
.with_child(build_calc_button(CalcButton::Nine, "9"))
.with_child(build_calc_button(CalcButton::Times, "*")),
1.,
)
.with_flex_child(
Flex::row()
.with_child(build_calc_button(CalcButton::D8, "d8"))
.with_child(build_calc_button(CalcButton::Four, "4"))
.with_child(build_calc_button(CalcButton::Five, "5"))
.with_child(build_calc_button(CalcButton::Six, "6"))
.with_child(build_calc_button(CalcButton::Minus, "-")),
1.,
)
.with_flex_child(
Flex::row()
.with_child(build_calc_button(CalcButton::D6, "d6"))
.with_child(build_calc_button(CalcButton::One, "1"))
.with_child(build_calc_button(CalcButton::Two, "2"))
.with_child(build_calc_button(CalcButton::Three, "3"))
.with_child(build_calc_button(CalcButton::Plus, "+")),
1.,
)
.with_flex_child(
Flex::row()
.with_child(build_calc_button(CalcButton::D4, "d4"))
.with_child(build_calc_button(CalcButton::PlaceholderNotCurrentlyInUse, ""))
.with_child(build_calc_button(CalcButton::Zero, "0"))
.with_child(build_calc_button(CalcButton::Decimal, "."))
.with_child(build_calc_button(CalcButton::Roll, "[Roll]")),
1.,
)
}
fn build_main_column() -> impl Widget<DiceCalculator> {
Split::rows(build_current_input_display(), build_main_calculator_display()).split_point(0.15).solid_bar(true)
}
fn build_latest_output_display() -> impl Widget<DiceCalculator> {
Align::centered(
Label::<DiceCalculator>::dynamic(|calc, _env| match calc.history.last() {
None => String::from("Result"),
Some(roll_result) => match &roll_result.1 {
Err(_) => String::from("Error"),
Ok(info) => format!("{}", info.value),
},
})
.with_text_size(50.)
)
}
fn build_history_display() -> impl Widget<DiceCalculator> {
Scroll::new(
Label::<DiceCalculator>::dynamic(|calc, _| {
let mut history = String::new();
for roll_result in calc.history.iter().rev() {
match roll_result {
(input, Err(e)) => history.push_str(&format!("Input: {}\nError: {}\n\n", input, e)),
(input, Ok(info)) => history.push_str(&format!("Input: {}\nRolled: {}\nResult: {}\n\n", input, info.processed_string, info.value)),
}
}
history
})
.with_line_break_mode(LineBreaking::WordWrap)
).vertical()
}
fn build_history_column() -> impl Widget<DiceCalculator> {
Split::rows(build_latest_output_display(), build_history_display()).split_point(0.15).solid_bar(true)
}
fn build_shortcut_creation_interface() -> impl Widget<DiceCalculator> {
Align::centered(
Flex::column()
.with_child(TextBox::new().with_placeholder("Name").lens(DiceCalculator::new_shortcut_name))
.with_child(ValueTextBox::new(TextBox::new().with_placeholder("Roll Text"), DiceTextFormatter {}).lens(DiceCalculator::new_shortcut_text))
.with_child(Button::new("Create Shortcut").on_click(DiceCalculator::add_shortcut))
)
}
fn build_shortcut_list() -> impl Widget<DiceCalculator> {
Align::centered(
Scroll::new(
List::new(|| {
Flex::column()
.with_child(Label::<RollShortcut>::dynamic(|shortcut, _env| format!("{}\n{}", shortcut.name, shortcut.roll)).with_line_break_mode(LineBreaking::WordWrap))
.with_child(
Flex::row()
.with_child(Button::new("Roll").on_click(|ctx, shortcut: &mut RollShortcut, _env| ctx.submit_command(Command::new(Selector::new("ShortcutRoll"), shortcut.clone(), Target::Global))))
.with_child(Button::new("Delete").on_click(|ctx, shortcut: &mut RollShortcut, _env| ctx.submit_command(Command::new(Selector::new("ShortcutDelete"), shortcut.clone(), Target::Global)))),
)
}).lens(DiceCalculator::shortcuts)
).vertical()
)
}
fn build_shortcuts_column() -> impl Widget<DiceCalculator> {
Split::rows(build_shortcut_creation_interface(), build_shortcut_list())
.split_point(0.15)
.solid_bar(true)
}
fn build_main_window() -> impl Widget<DiceCalculator> {
Split::columns(
Split::columns(build_shortcuts_column(), build_main_column()).split_point(1./3.).solid_bar(true).draggable(true),
build_history_column(),
)
.split_point(0.75)
.solid_bar(true)
.draggable(true)
.controller(DiceCalcEventHandler {})
}
fn build_file_menu<T: Data>() -> MenuDesc<T> {
let exit = MenuItem::new(LocalizedString::new("Exit"), QUIT_APP);
MenuDesc::new(LocalizedString::new("File")).append(exit)
}
fn build_menus<T: Data>() -> MenuDesc<T> {
MenuDesc::empty().append(build_file_menu())
}
fn main() {
let config = load_config();
let calculator = DiceCalculator::new(config);
save_config(&calculator);
let window = WindowDesc::new(build_main_window).title("Fluorite").menu(build_menus());
AppLauncher::with_window(window).launch(calculator).unwrap();
}
| 37.281469 | 225 | 0.572614 |
53d6ff5616596c15daaddc7a432f9e8335c58a71 | 10,482 | java | Java | src/main/java/com/usermodule/services/UserServiceImpl.java | ydengGitHub/UserModule | a25169eadda1c8e2cfbc35f2144f3838573931cd | [
"MIT"
] | null | null | null | src/main/java/com/usermodule/services/UserServiceImpl.java | ydengGitHub/UserModule | a25169eadda1c8e2cfbc35f2144f3838573931cd | [
"MIT"
] | null | null | null | src/main/java/com/usermodule/services/UserServiceImpl.java | ydengGitHub/UserModule | a25169eadda1c8e2cfbc35f2144f3838573931cd | [
"MIT"
] | null | null | null | package com.usermodule.services;
import javax.mail.MessagingException;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.validation.BindingResult;
import com.usermodule.dto.ChangeEmailForm;
import com.usermodule.dto.ChangePasswordForm;
import com.usermodule.dto.ForgotPasswordForm;
import com.usermodule.dto.ResetPasswordForm;
import com.usermodule.dto.SignupForm;
import com.usermodule.dto.UserDetailsImpl;
import com.usermodule.dto.UserEditForm;
import com.usermodule.entities.User;
import com.usermodule.entities.User.Role;
import com.usermodule.mail.MailSender;
import com.usermodule.repositories.UserRepository;
import com.usermodule.util.MyUtil;
/*Implementation of UserService interface, Service annotation is like @Component*/
/*Add data entry to database*/
@Service
@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
public class UserServiceImpl implements UserService, UserDetailsService {
private static final Logger logger=LoggerFactory.getLogger(UserServiceImpl.class);
private UserRepository userRepository;
private PasswordEncoder passwordEncoder;
private MailSender mailSender;
@Autowired
public UserServiceImpl(UserRepository userRepository, PasswordEncoder passwordEncoder,
MailSender mailSender){
this.userRepository=userRepository;
this.passwordEncoder=passwordEncoder;
this.mailSender=mailSender;
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void signup(SignupForm signupForm) {
final User user=new User();//need to define as final to make TransactionSynchronization works
user.setEmail(signupForm.getEmail());
user.setName(signupForm.getName());
user.setPassword(passwordEncoder.encode(signupForm.getPassword()));
user.getRoles().add(Role.UNVERIFIED);
//Apache RandomStringUtils class, need to include by adding to pom.xml
user.setVerificationCode(RandomStringUtils.randomAlphanumeric(User.RANDOM_CODE_LENGTH));
userRepository.save(user);
//int j=20/0; //if met error, the user will not be added to database
/*Deal with the situation: user get email, but error occur and roll back.
* Tell Spring, Only run these codes when the transaction succeed.*/
TransactionSynchronizationManager.registerSynchronization(
new TransactionSynchronizationAdapter() {
@Override
public void afterCommit() {
try {
String verifyLink = MyUtil.hostUrl() + "/users/" + user.getVerificationCode() + "/verify";
//verifyLink will be inserted to {0} of "verifyEmail" message
mailSender.send(user.getEmail(), MyUtil.getMessage("verifySubject"), MyUtil.getMessage("verifyEmail", verifyLink));
logger.info("Verification mail to " + user.getEmail() + " queued.");
} catch (MessagingException e) {
logger.error(ExceptionUtils.getStackTrace(e));
}
}
});
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user=userRepository.findByEmail(username);
if(user==null) throw new UsernameNotFoundException(username);
return new UserDetailsImpl(user);
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void verify(String verificationCode) {
/*
long loggedInUserId=MyUtil.getSessionUser().getId();
User user=userRepository.findOne(loggedInUserId);*/
User user=userRepository.findByVerificationCode(verificationCode);
/*if false, displayed the message associate with second arg, third argument will be inserted to the message*/
MyUtil.validate(user.getRoles().contains(Role.UNVERIFIED), "alreadyVerified");
//MyUtil.validate(user.getVerificationCode().equals(verificationCode), "incorrect", "verification code");
user.getRoles().remove(Role.UNVERIFIED);
user.setVerificationCode(null);
userRepository.save(user);//update the database
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void forgotPassword(ForgotPasswordForm form) {
final User user=userRepository.findByEmail(form.getEmail());
String forgotPasswordCode=RandomStringUtils.randomAlphanumeric(User.RANDOM_CODE_LENGTH);
User existUser=userRepository.findByForgotPasswordCode(forgotPasswordCode);
while(existUser!=null){
forgotPasswordCode=RandomStringUtils.randomAlphanumeric(User.RANDOM_CODE_LENGTH);
existUser=userRepository.findByForgotPasswordCode(forgotPasswordCode);
}
user.setForgotPasswordCode(forgotPasswordCode);
final User savedUser=userRepository.save(user);
TransactionSynchronizationManager.registerSynchronization(
new TransactionSynchronizationAdapter(){
@Override
public void afterCommit(){
try{
mailForgotPasswordLink(savedUser);
}catch (MessagingException e){
logger.error(ExceptionUtils.getStackTrace(e));
}
}
});
}
private void mailForgotPasswordLink(User user) throws MessagingException{
String forgotPasswordLink =
MyUtil.hostUrl() + "/reset-password/" +
user.getForgotPasswordCode();
mailSender.send(user.getEmail(),
MyUtil.getMessage("forgotPasswordSubject"),
MyUtil.getMessage("forgotPasswordEmail", forgotPasswordLink));
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void resetPassword(String forgotPasswordCode,
ResetPasswordForm resetPasswordForm,
BindingResult result) {
User user = userRepository.findByForgotPasswordCode(forgotPasswordCode);
if (user == null) result.reject("invalidForgotPassword");
if (result.hasErrors()) return;
user.setForgotPasswordCode(null);
user.setPassword(passwordEncoder.encode(resetPasswordForm.getPassword().trim()));
userRepository.save(user);
}
@Override
public User findOne(long userId) {
//show different sets of information based on login user roles
User loggedIn=MyUtil.getSessionUser();
User user=userRepository.findOne(userId);
if(loggedIn ==null ||
loggedIn.getId()!=user.getId() && !loggedIn.isAdmin()){
//hide the email id
user.setEmail("Confidential");
}
return user;
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void update(long userId, UserEditForm userEditForm) {
User loggedIn=MyUtil.getSessionUser();
MyUtil.validate(loggedIn.isAdmin() ||
loggedIn.getId()==userId, "noPermission");
User user=userRepository.findOne(userId);
user.setName(userEditForm.getName());
if(loggedIn.isAdmin()) user.setRoles(userEditForm.getRoles());
userRepository.save(user);
}
@Override
public boolean checkPassword(long userId, String password){
User user=userRepository.findById(userId);
return passwordEncoder.matches(password.trim(), user.getPassword());
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void changePassword(long userId,
ChangePasswordForm changePasswordForm,
BindingResult result) {
User user = userRepository.findById(userId);
if (user == null) result.reject("userNotFound");
User loggedIn=MyUtil.getSessionUser();
MyUtil.validate(loggedIn.isAdmin() ||
loggedIn.getId()==userId, "noPermission");
if(!loggedIn.isAdmin() && !checkPassword(userId, changePasswordForm.getOldPassword()))
result.reject("incorrectPassword");
if (result.hasErrors()) return;
user.setPassword(passwordEncoder.encode(changePasswordForm.getNewPassword().trim()));
userRepository.save(user);
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void changeEmail(long userId, ChangeEmailForm changeEmailForm, BindingResult result) {
final User user = userRepository.findById(userId);
if (user == null) result.reject("userNotFound");
if (result.hasErrors()) return;
User loggedIn=MyUtil.getSessionUser();
MyUtil.validate(loggedIn.isAdmin() ||
loggedIn.getId()==userId, "noPermission");
String changeEmailCode=RandomStringUtils.randomAlphanumeric(User.RANDOM_CODE_LENGTH);
User existUser=userRepository.findByChangeEmailCode(changeEmailCode);
while(existUser!=null){
changeEmailCode=RandomStringUtils.randomAlphanumeric(User.RANDOM_CODE_LENGTH);
existUser=userRepository.findByChangeEmailCode(changeEmailCode);
}
user.setChangeEmailCode(changeEmailCode);
user.setNewEmail(changeEmailForm.getEmail());
user.getRoles().add(User.Role.CHANGINGEMAIL);
final User savedUser=userRepository.save(user);
TransactionSynchronizationManager.registerSynchronization(
new TransactionSynchronizationAdapter(){
@Override
public void afterCommit(){
try{
mailChangeEmailLink(savedUser);
}catch (MessagingException e){
logger.error(ExceptionUtils.getStackTrace(e));
}
}
});
}
private void mailChangeEmailLink(User user) throws MessagingException{
String changeEmailLink =
MyUtil.hostUrl() + "/users/" +
user.getChangeEmailCode()+"/verifyEmail";
mailSender.send(user.getNewEmail(),
MyUtil.getMessage("changeEmailSubject"),
MyUtil.getMessage("changeEmailEmail", changeEmailLink));
}
@Override
@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
public void verifyEmail(String changeEmailCode) {
User user=userRepository.findByChangeEmailCode(changeEmailCode);
/*if false, 显示第二个参数key对应的 信息, third argument will be inserted to the message*/
MyUtil.validate(user!=null, "userNotFound");
MyUtil.validate(user.getRoles().contains(Role.CHANGINGEMAIL), "alreadyVerified");
user.getRoles().remove(Role.CHANGINGEMAIL);
user.setChangeEmailCode(null);
user.setEmail(user.getNewEmail());
user.setNewEmail(null);
userRepository.save(user);//update the database
}
}
| 39.704545 | 125 | 0.778096 |
aabd98c2dc4d7421d3148b483bcb9462f23e43f7 | 18,160 | swift | Swift | src/xcode/ENA/ENA/Source/Services/Risk/Calculation/__tests__/RiskCalculationTests.swift | ckuelker/cwa-app-ios | 2ce0f6182955392e94b0e735da79c05b91faee0e | [
"Apache-2.0"
] | null | null | null | src/xcode/ENA/ENA/Source/Services/Risk/Calculation/__tests__/RiskCalculationTests.swift | ckuelker/cwa-app-ios | 2ce0f6182955392e94b0e735da79c05b91faee0e | [
"Apache-2.0"
] | null | null | null | src/xcode/ENA/ENA/Source/Services/Risk/Calculation/__tests__/RiskCalculationTests.swift | ckuelker/cwa-app-ios | 2ce0f6182955392e94b0e735da79c05b91faee0e | [
"Apache-2.0"
] | null | null | null | //
// Corona-Warn-App
//
// SAP SE and all other contributors
// copyright owners license this file to you under the Apache
// License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
@testable import ENA
import ExposureNotification
import XCTest
// swiftlint:disable file_length
// swiftlint:disable:next type_body_length
final class RiskCalculationTests: XCTestCase {
private let store = MockTestStore()
// MARK: - Tests for calculating raw risk score
func testCalculateRawRiskScore_Zero() throws {
let summaryZeroMaxRisk = makeExposureSummaryContainer(maxRiskScoreFullRange: 0, ad_low: 10, ad_mid: 10, ad_high: 10)
XCTAssertEqual(RiskCalculation.calculateRawRisk(summary: summaryZeroMaxRisk, configuration: appConfig), 0.0, accuracy: 0.01)
}
func testCalculateRawRiskScore_Low() throws {
XCTAssertEqual(RiskCalculation.calculateRawRisk(summary: summaryLow, configuration: appConfig), 1.07, accuracy: 0.01)
}
func testCalculateRawRiskScore_Med() throws {
XCTAssertEqual(RiskCalculation.calculateRawRisk(summary: summaryMed, configuration: appConfig), 2.56, accuracy: 0.01)
}
func testCalculateRawRiskScore_High() throws {
XCTAssertEqual(RiskCalculation.calculateRawRisk(summary: summaryHigh, configuration: appConfig), 10.2, accuracy: 0.01)
}
// MARK: - Tests for calculating risk levels
func testCalculateRisk_Inactive() {
// Test the condition when the risk is returned as inactive
// This occurs when the preconditions are not met, ex. when tracing is off.
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
let risk = RiskCalculation.risk(
summary: summaryHigh,
configuration: appConfig,
dateLastExposureDetection: Date(),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.invalid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .inactive)
}
func testCalculateRisk_UnknownInitial() {
// Test the condition when the risk is returned as unknownInitial
// That will happen when:
// 1. The number of hours tracing has been active for is less than one day
// 2. There is no ENExposureDetectionSummary to use
// Test case for tracing not being active long enough
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
var risk = RiskCalculation
.risk(
summary: summaryLow,
configuration: appConfig,
dateLastExposureDetection: Date(),
numberOfTracingActiveHours: 0,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .unknownInitial)
// Test case when summary is nil
risk = RiskCalculation.risk(
summary: nil,
configuration: appConfig,
dateLastExposureDetection: Date(),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .unknownInitial)
}
func testCalculateRisk_UnknownOutdated() {
// Test the condition when the risk is returned as unknownOutdated.
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// That will happen when the date of last exposure detection is older than one day
let risk = RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -2)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .unknownOutdated)
}
func testCalculateRisk_UnknownOutdated2() {
// Test the condition when the risk is returned as unknownOutdated.
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 2),
exposureDetectionInterval: .init(day: 2),
detectionMode: .automatic
)
// That will happen when the date of last exposure detection is older than one day
let risk = RiskCalculation.risk(
summary: nil,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -1)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .unknownInitial)
XCTAssertEqual(
RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -3)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)?.level,
.unknownOutdated
)
XCTAssertEqual(
RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -1)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)?.level,
.low
)
}
func testCalculateRisk_LowRisk() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where preconditions pass and there is low risk
let risk = RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .low)
}
func testCalculateRisk_IncreasedRisk() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
var summary = summaryHigh
summary.daysSinceLastExposure = 5
summary.matchedKeyCount = 10
// Test the case where preconditions pass and there is increased risk
let risk = RiskCalculation.risk(
summary: summary,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.details.daysSinceLastExposure, 5)
XCTAssertEqual(risk?.level, .increased)
}
// MARK: - Risk Level Calculation Error Cases
func testCalculateRisk_OutsideRangeError_Middle() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where preconditions pass and there is increased risk
// Values below are hand-picked to result in a raw risk score of 5.12 - within a gap in the range
let summary = makeExposureSummaryContainer(maxRiskScoreFullRange: 128, ad_low: 30, ad_mid: 30, ad_high: 30)
let risk = RiskCalculation.risk(
summary: summary,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertNil(risk)
}
func testCalculateRisk_OutsideRangeError_OffHigh() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where preconditions pass and there is increased risk
// Values below are hand-picked to result in a raw risk score of 13.6 - outside of the top range of the config
let summary = makeExposureSummaryContainer(maxRiskScoreFullRange: 255, ad_low: 40, ad_mid: 40, ad_high: 40)
let risk = RiskCalculation.risk(
summary: summary,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertNil(risk)
}
func testCalculateRisk_OutsideRangeError_TooLow() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where preconditions pass and there is increased risk
// Values below are hand-picked to result in a raw risk score of 0.85 - outside of the bottom bound of the config
let summary = makeExposureSummaryContainer(maxRiskScoreFullRange: 64, ad_low: 10, ad_mid: 10, ad_high: 10)
let risk = RiskCalculation.risk(
summary: summary,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertNil(risk)
}
// MARK: - Risk Level Calculation Hierarchy Tests
// There is a certain order to risk levels, and some override others. This is tested below.
func testCalculateRisk_IncreasedOverridesUnknownOutdated() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test case where last exposure summary was gotten too far in the past,
// But the risk is increased
let risk = RiskCalculation.risk(
summary: summaryHigh,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -2)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .increased)
XCTAssertTrue(risk?.riskLevelHasChanged == false)
}
func testCalculateRisk_UnknownInitialOverridesUnknownOutdated() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test case where last exposure summary was gotten too far in the past,
let risk = RiskCalculation.risk(
summary: nil,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -2)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
XCTAssertEqual(risk?.level, .unknownInitial)
}
// MARK: - RiskLevel changed tests
func testCalculateRisk_RiskChanged_WithPreviousRisk() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where we have an old risk level in the store,
// and the new risk level has changed
// Will produce increased risk
let risk = RiskCalculation.risk(
summary: summaryHigh,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: .low,
providerConfiguration: config
)
XCTAssertNotNil(risk)
XCTAssertEqual(risk?.level, .increased)
XCTAssertTrue(risk?.riskLevelHasChanged ?? false)
}
func testCalculateRisk_RiskChanged_NoPreviousRisk() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where we do not have an old risk level in the store,
// and the new risk level has changed
// Will produce high risk
let risk = RiskCalculation.risk(
summary: summaryHigh,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: nil,
providerConfiguration: config
)
// Going from unknown -> increased or low risk does not produce a change
XCTAssertFalse(risk?.riskLevelHasChanged ?? true)
}
func testCalculateRisk_RiskNotChanged() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where we have an old risk level in the store,
// and the new risk level has not changed
let risk = RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
// arbitrary, but within limit
dateLastExposureDetection: Date().addingTimeInterval(-3600),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: .low,
providerConfiguration: config
)
XCTAssertFalse(risk?.riskLevelHasChanged ?? true)
}
func testCalculateRisk_LowToUnknown() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where we have low risk level in the store,
// and the new risk calculation returns unknown
// Produces unknown risk
let risk = RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -2)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: .low,
providerConfiguration: config
)
// The risk level did not change - we only care about changes between low and increased
XCTAssertFalse(risk?.riskLevelHasChanged ?? true)
}
func testCalculateRisk_IncreasedToUnknown() {
let config = RiskProvidingConfiguration(
exposureDetectionValidityDuration: .init(day: 1),
exposureDetectionInterval: .init(day: 1),
detectionMode: .automatic
)
// Test the case where we have low risk level in the store,
// and the new risk calculation returns unknown
// Produces unknown risk
let risk = RiskCalculation.risk(
summary: summaryLow,
configuration: appConfig,
dateLastExposureDetection: Date().addingTimeInterval(.init(days: -2)),
numberOfTracingActiveHours: 48,
preconditions: preconditions(.valid),
previousRiskLevel: .increased,
providerConfiguration: config
)
// The risk level did not change - we only care about changes between low and increased
XCTAssertFalse(risk?.riskLevelHasChanged ?? true)
}
}
// MARK: - Helpers
private extension RiskCalculationTests {
private var appConfig: SAP_ApplicationConfiguration {
makeAppConfig(w_low: 1.0, w_med: 0.5, w_high: 0.5)
}
private var summaryLow: CodableExposureDetectionSummary {
makeExposureSummaryContainer(maxRiskScoreFullRange: 80, ad_low: 10, ad_mid: 10, ad_high: 10)
}
private var summaryMed: CodableExposureDetectionSummary {
makeExposureSummaryContainer(maxRiskScoreFullRange: 128, ad_low: 15, ad_mid: 15, ad_high: 15)
}
private var summaryHigh: CodableExposureDetectionSummary {
makeExposureSummaryContainer(maxRiskScoreFullRange: 255, ad_low: 30, ad_mid: 30, ad_high: 30)
}
enum PreconditionState {
case valid
case invalid
}
private func preconditions(_ state: PreconditionState) -> ExposureManagerState {
switch state {
case .valid:
return .init(
authorized: true,
enabled: true,
status:
.active
)
default:
return .init(authorized: true, enabled: false, status: .disabled)
}
}
private func makeExposureSummaryContainer(
maxRiskScoreFullRange: Int,
ad_low: Double,
ad_mid: Double,
ad_high: Double
) -> CodableExposureDetectionSummary {
.init(
daysSinceLastExposure: 0,
matchedKeyCount: 0,
maximumRiskScore: 0,
attenuationDurations: [ad_low, ad_mid, ad_high],
maximumRiskScoreFullRange: maxRiskScoreFullRange
)
}
/// Makes an mock `SAP_ApplicationConfiguration`
///
/// Some defaults are applied for ad_norm, w4, and low & high ranges
private func makeAppConfig(
ad_norm: Int32 = 25,
w4: Int32 = 0,
w_low: Double,
w_med: Double,
w_high: Double,
riskRangeLow: ClosedRange<Int32> = 1...5,
// Gap between the ranges is on purpose, this is an edge case to test
riskRangeHigh: Range<Int32> = 6..<11
) -> SAP_ApplicationConfiguration {
var config = SAP_ApplicationConfiguration()
config.attenuationDuration.defaultBucketOffset = w4
config.attenuationDuration.riskScoreNormalizationDivisor = ad_norm
config.attenuationDuration.weights.low = w_low
config.attenuationDuration.weights.mid = w_med
config.attenuationDuration.weights.high = w_high
var riskScoreClassLow = SAP_RiskScoreClass()
riskScoreClassLow.label = "LOW"
riskScoreClassLow.min = riskRangeLow.lowerBound
riskScoreClassLow.max = riskRangeLow.upperBound
var riskScoreClassHigh = SAP_RiskScoreClass()
riskScoreClassHigh.label = "HIGH"
riskScoreClassHigh.min = riskRangeHigh.lowerBound
riskScoreClassHigh.max = riskRangeHigh.upperBound
config.riskScoreClasses.riskClasses = [
riskScoreClassLow,
riskScoreClassHigh
]
return config
}
}
private extension TimeInterval {
init(days: Int) {
self = Double(days * 24 * 60 * 60)
}
}
| 31.310345 | 126 | 0.752698 |
63052ad90e44d3c07d677d83c09cc77693adcf57 | 797 | sql | SQL | Application/Migration/1634393825-followed-users.sql | windorg/app | 3981b86f26cf64fc907ff478e76240a592476fa7 | [
"MIT"
] | 27 | 2021-11-18T13:27:13.000Z | 2021-12-30T03:56:56.000Z | Application/Migration/1634393825-followed-users.sql | windorg/app | 3981b86f26cf64fc907ff478e76240a592476fa7 | [
"MIT"
] | 1 | 2021-12-06T16:41:46.000Z | 2021-12-06T17:05:37.000Z | Application/Migration/1634393825-followed-users.sql | windorg/app | 3981b86f26cf64fc907ff478e76240a592476fa7 | [
"MIT"
] | 3 | 2021-11-18T15:18:30.000Z | 2021-11-19T03:26:19.000Z | CREATE TABLE followed_users (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
subscriber_id UUID NOT NULL,
followed_user_id UUID NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
);
CREATE INDEX followed_users_subscriber_id_index ON followed_users (subscriber_id);
CREATE INDEX followed_users_followed_user_id_index ON followed_users (followed_user_id);
ALTER TABLE followed_users ADD CONSTRAINT followed_users_ref_followed_user_id FOREIGN KEY (followed_user_id) REFERENCES users (id) ON DELETE CASCADE;
ALTER TABLE followed_users ADD CONSTRAINT followed_users_ref_subscriber_id FOREIGN KEY (subscriber_id) REFERENCES users (id) ON DELETE CASCADE;
ALTER TABLE followed_users ADD CONSTRAINT followed_users_unique UNIQUE (subscriber_id, followed_user_id); | 72.454545 | 149 | 0.841907 |
8e522bd8855c8a3f4bc21fdb2ca63d08f4541aaf | 170 | sql | SQL | 3. Aggregation/03. Revising Aggregations - Averages.sql | satyarthiabhay/Hackerrank-SQL-Challenges | f3071d0ae8c516a3d0977c7feb81a9027c5c269d | [
"MIT"
] | 4 | 2021-07-17T22:32:20.000Z | 2021-07-31T11:48:36.000Z | 3. Aggregation/03. Revising Aggregations - Averages.sql | satyarthiabhay/Hackerrank-SQL-Challenges | f3071d0ae8c516a3d0977c7feb81a9027c5c269d | [
"MIT"
] | null | null | null | 3. Aggregation/03. Revising Aggregations - Averages.sql | satyarthiabhay/Hackerrank-SQL-Challenges | f3071d0ae8c516a3d0977c7feb81a9027c5c269d | [
"MIT"
] | null | null | null | -- Problem : https://www.hackerrank.com/challenges/revising-aggregations-the-average-function/problem
SELECT AVG(POPULATION)
FROM CITY
WHERE DISTRICT='California'; | 34 | 102 | 0.782353 |
ad17a15fc3f7ec95e0c56526b7f77a849f49a29f | 1,360 | swift | Swift | TelephoneDirectory/Common/Persistence/PersistenceProtocol.swift | daniele99999999/Telephone-Directory-Mobile-Edition | 51da815295b0e7abf3aafa2650e9bf7b126d9c31 | [
"MIT"
] | null | null | null | TelephoneDirectory/Common/Persistence/PersistenceProtocol.swift | daniele99999999/Telephone-Directory-Mobile-Edition | 51da815295b0e7abf3aafa2650e9bf7b126d9c31 | [
"MIT"
] | null | null | null | TelephoneDirectory/Common/Persistence/PersistenceProtocol.swift | daniele99999999/Telephone-Directory-Mobile-Edition | 51da815295b0e7abf3aafa2650e9bf7b126d9c31 | [
"MIT"
] | null | null | null | //
// PersistenceProtocol.swift
// TelephoneDirectory
//
// Created by Daniele Salvioni on 12/11/2019.
// Copyright © 2019 Daniele Salvioni. All rights reserved.
//
import Foundation
protocol PersistenceIdentifier
{
func toIdentifier() -> Int64?
}
extension String: PersistenceIdentifier
{
func toIdentifier() -> Int64? { return Int64(self) }
}
extension Int: PersistenceIdentifier
{
func toIdentifier() -> Int64? { return Int64(self) }
}
extension Date: PersistenceIdentifier
{
func toIdentifier() -> Int64? { return Int64(self.timeIntervalSinceNow) }
}
extension Int64: PersistenceIdentifier
{
func toIdentifier() -> Int64? { return self }
}
protocol PersistenceProtocol: class
{
func createTable()
func getAllEntity() -> [ContactModel]
func getAllEntityFilteredByFirstAndLastName(filter: String) -> [ContactModel]
func getAllEntityFilteredByPhoneNumber(filter: String) -> [ContactModel]
func getAllEntityFilteredByAll(filter: String) -> [ContactModel]
func getEntity(identifier: PersistenceIdentifier) -> ContactModel?
@discardableResult func addEntity(_ entity: ContactModel) -> Bool
@discardableResult func updateEntity(_ entity: ContactModel) -> Bool
@discardableResult func deleteEntity(identifier: PersistenceIdentifier) -> Bool
@discardableResult func deleteAllEntity() -> Bool
}
| 27.755102 | 83 | 0.744118 |
4015b37b17e6ad94221973a7573095f03e406d98 | 922 | py | Python | sepicker/interface/can_bus.py | danielbayerlein/sepicker | 58a1685a6e4bcbbacdb717b91d748d179d38b2d6 | [
"MIT"
] | 4 | 2021-08-04T07:20:58.000Z | 2022-03-22T17:02:53.000Z | sepicker/interface/can_bus.py | danielbayerlein/sepicker | 58a1685a6e4bcbbacdb717b91d748d179d38b2d6 | [
"MIT"
] | 5 | 2020-03-08T19:17:08.000Z | 2022-03-24T04:09:17.000Z | sepicker/interface/can_bus.py | danielbayerlein/sepicker | 58a1685a6e4bcbbacdb717b91d748d179d38b2d6 | [
"MIT"
] | 1 | 2021-01-22T16:28:47.000Z | 2021-01-22T16:28:47.000Z | import logging
import sys
import can
LOGGER = logging.getLogger(__name__)
class CanBus:
def __init__(self, interface, sender):
self.interface = interface
self.sender = int(str(sender), 16)
def __enter__(self):
try:
self.bus = can.interface.Bus(
channel=self.interface,
bustype='socketcan'
)
return self
except OSError:
LOGGER.error('Can not connect to interface "%s".', self.interface)
sys.exit(1)
def __exit__(self, exc_type, exc_val, exc_tb):
self.notifier.stop()
self.bus.shutdown()
def send(self, data):
msg = can.Message(
arbitration_id=self.sender,
data=data,
extended_id=False
)
self.bus.send(msg)
def notifier(self, listener):
self.notifier = can.Notifier(self.bus, [listener])
| 23.641026 | 78 | 0.567245 |
878b8f5cf1f0ec62878e95ff4c050330e09d9ab5 | 22,576 | xhtml | HTML | src/epub/toc.xhtml | standardebooks/aleksandr-kuprin_short-fiction_s-koteliansky_j-m-murry_stephen-graham_rosa-savory-graham_leo-pasvols | 122458eeda65f5c191c32f28276cce8e9c05cf65 | [
"CC0-1.0"
] | null | null | null | src/epub/toc.xhtml | standardebooks/aleksandr-kuprin_short-fiction_s-koteliansky_j-m-murry_stephen-graham_rosa-savory-graham_leo-pasvols | 122458eeda65f5c191c32f28276cce8e9c05cf65 | [
"CC0-1.0"
] | null | null | null | src/epub/toc.xhtml | standardebooks/aleksandr-kuprin_short-fiction_s-koteliansky_j-m-murry_stephen-graham_rosa-savory-graham_leo-pasvols | 122458eeda65f5c191c32f28276cce8e9c05cf65 | [
"CC0-1.0"
] | null | null | null | <?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" epub:prefix="z3998: http://www.daisy.org/z3998/2012/vocab/structure/, se: https://standardebooks.org/vocab/1.0" xml:lang="en-US">
<head>
<title>Table of Contents</title>
</head>
<body epub:type="frontmatter">
<nav id="toc" epub:type="toc">
<h2 epub:type="title">Table of Contents</h2>
<ol>
<li>
<a href="text/titlepage.xhtml">Titlepage</a>
</li>
<li>
<a href="text/imprint.xhtml">Imprint</a>
</li>
<li>
<a href="text/foreword.xhtml">Foreword</a>
</li>
<li>
<a href="text/halftitlepage.xhtml">Short Fiction</a>
<ol>
<li>
<a href="text/the-river-of-life.xhtml">The River of Life</a>
<ol>
<li>
<a href="text/the-river-of-life.xhtml#the-river-of-life-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-river-of-life.xhtml#the-river-of-life-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-river-of-life.xhtml#the-river-of-life-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-river-of-life.xhtml#the-river-of-life-4" epub:type="z3998:roman">IV</a>
</li>
</ol>
</li>
<li>
<a href="text/captain-ribnikov.xhtml">Captain Ribnikov</a>
<ol>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/captain-ribnikov.xhtml#captain-ribnikov-7" epub:type="z3998:roman">VII</a>
</li>
</ol>
</li>
<li>
<a href="text/the-outrage.xhtml">The Outrage</a>
</li>
<li>
<a href="text/the-witch.xhtml">The Witch</a>
<ol>
<li>
<a href="text/the-witch.xhtml#the-witch-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-8" epub:type="z3998:roman">VIII</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-9" epub:type="z3998:roman">IX</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-10" epub:type="z3998:roman">X</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-11" epub:type="z3998:roman">XI</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-12" epub:type="z3998:roman">XII</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-13" epub:type="z3998:roman">XIII</a>
</li>
<li>
<a href="text/the-witch.xhtml#the-witch-14" epub:type="z3998:roman">XIV</a>
</li>
</ol>
</li>
<li>
<a href="text/a-slav-soul.xhtml">A Slav Soul</a>
</li>
<li>
<a href="text/the-song-and-the-dance.xhtml">The Song and the Dance</a>
</li>
<li>
<a href="text/easter-day.xhtml">Easter Day</a>
</li>
<li>
<a href="text/the-idiot.xhtml">The Idiot</a>
</li>
<li>
<a href="text/the-picture.xhtml">The Picture</a>
<ol>
<li>
<a href="text/the-picture.xhtml#the-picture-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-8" epub:type="z3998:roman">VIII</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-9" epub:type="z3998:roman">IX</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-10" epub:type="z3998:roman">X</a>
</li>
<li>
<a href="text/the-picture.xhtml#the-picture-11" epub:type="z3998:roman">XI</a>
</li>
</ol>
</li>
<li>
<a href="text/hamlet.xhtml">Hamlet</a>
<ol>
<li>
<a href="text/hamlet.xhtml#hamlet-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/hamlet.xhtml#hamlet-8" epub:type="z3998:roman">VIII</a>
</li>
</ol>
</li>
<li>
<a href="text/mechanical-justice.xhtml">Mechanical Justice</a>
</li>
<li>
<a href="text/the-last-word.xhtml">The Last Word</a>
</li>
<li>
<a href="text/the-white-poodle.xhtml">The White Poodle</a>
<ol>
<li>
<a href="text/the-white-poodle.xhtml#the-white-poodle-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-white-poodle.xhtml#the-white-poodle-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-white-poodle.xhtml#the-white-poodle-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-white-poodle.xhtml#the-white-poodle-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-white-poodle.xhtml#the-white-poodle-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/the-white-poodle.xhtml#the-white-poodle-6" epub:type="z3998:roman">VI</a>
</li>
</ol>
</li>
<li>
<a href="text/the-elephant.xhtml">The Elephant</a>
<ol>
<li>
<a href="text/the-elephant.xhtml#the-elephant-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-elephant.xhtml#the-elephant-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-elephant.xhtml#the-elephant-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-elephant.xhtml#the-elephant-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-elephant.xhtml#the-elephant-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/the-elephant.xhtml#the-elephant-6" epub:type="z3998:roman">VI</a>
</li>
</ol>
</li>
<li>
<a href="text/dogs-happiness.xhtml">Dogs’ Happiness</a>
</li>
<li>
<a href="text/a-clump-of-lilacs.xhtml">A Clump of Lilacs</a>
</li>
<li>
<a href="text/tempting-providence.xhtml">Tempting Providence</a>
</li>
<li>
<a href="text/cain.xhtml">Cain</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml">The Bracelet of Garnets</a>
<ol>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-8" epub:type="z3998:roman">VIII</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-9" epub:type="z3998:roman">IX</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-10" epub:type="z3998:roman">X</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-11" epub:type="z3998:roman">XI</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-12" epub:type="z3998:roman">XII</a>
</li>
<li>
<a href="text/the-bracelet-of-garnets.xhtml#the-bracelet-of-garnets-13" epub:type="z3998:roman">XIII</a>
</li>
</ol>
</li>
<li>
<a href="text/the-horse-thieves.xhtml">The Horse-Thieves</a>
<ol>
<li>
<a href="text/the-horse-thieves.xhtml#the-horse-thieves-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-horse-thieves.xhtml#the-horse-thieves-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-horse-thieves.xhtml#the-horse-thieves-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-horse-thieves.xhtml#the-horse-thieves-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-horse-thieves.xhtml#the-horse-thieves-5" epub:type="z3998:roman">V</a>
</li>
</ol>
</li>
<li>
<a href="text/anathema.xhtml">Anathema</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml">The Laestrygonians</a>
<ol>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-1"><span epub:type="z3998:roman">I</span>: Silence</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-2"><span epub:type="z3998:roman">II</span>: The Mackerel</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-3"><span epub:type="z3998:roman">III</span>: Poaching</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-4"><span epub:type="z3998:roman">IV</span>: White Sturgeon</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-5"><span epub:type="z3998:roman">V</span>: The Lord’s Fish</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-6"><span epub:type="z3998:roman">VI</span>: Bora</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7"><span epub:type="z3998:roman">VII</span>: The Divers</a>
<ol>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/the-laestrygonians.xhtml#the-laestrygonians-7-7" epub:type="z3998:roman">VII</a>
</li>
</ol>
</li>
</ol>
</li>
<li>
<a href="text/the-park-of-kings.xhtml">The Park of Kings</a>
</li>
<li>
<a href="text/an-evening-guest.xhtml">An Evening Guest</a>
</li>
<li>
<a href="text/a-legend.xhtml">A Legend</a>
</li>
<li>
<a href="text/demir-kaya.xhtml">Demir-Kayá</a>
</li>
<li>
<a href="text/the-garden-of-the-holy-virgin.xhtml">The Garden of the Holy Virgin</a>
</li>
<li>
<a href="text/sasha.xhtml">Sasha</a>
<ol>
<li>
<a href="text/sasha.xhtml#sasha-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/sasha.xhtml#sasha-8" epub:type="z3998:roman">VIII</a>
</li>
</ol>
</li>
<li>
<a href="text/a-sentimental-romance.xhtml">A Sentimental Romance</a>
</li>
<li>
<a href="text/the-army-ensign.xhtml">The Army Ensign</a>
<ol>
<li>
<a href="text/the-army-ensign.xhtml#the-army-ensign-prologue">Prologue</a>
</li>
<li>
<a href="text/the-army-ensign.xhtml#the-army-ensign-1" epub:type="z3998:roman">I</a>
</li>
</ol>
</li>
<li>
<a href="text/autumn-flowers.xhtml">Autumn Flowers</a>
</li>
<li>
<a href="text/emerald.xhtml">Emerald</a>
<ol>
<li>
<a href="text/emerald.xhtml#emerald-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/emerald.xhtml#emerald-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/emerald.xhtml#emerald-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/emerald.xhtml#emerald-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/emerald.xhtml#emerald-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/emerald.xhtml#emerald-6" epub:type="z3998:roman">VI</a>
</li>
</ol>
</li>
<li>
<a href="text/happiness.xhtml">Happiness</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml">How I Became an Actor</a>
<ol>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-8" epub:type="z3998:roman">VIII</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-9" epub:type="z3998:roman">IX</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-10" epub:type="z3998:roman">X</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-11" epub:type="z3998:roman">XI</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-12" epub:type="z3998:roman">XII</a>
</li>
<li>
<a href="text/how-i-became-an-actor.xhtml#how-i-became-an-actor-13" epub:type="z3998:roman">XIII</a>
</li>
</ol>
</li>
<li>
<a href="text/allez.xhtml">“<i xml:lang="fr">Allez!</i>”</a>
</li>
<li>
<a href="text/black-fog.xhtml">Black Fog</a>
</li>
<li>
<a href="text/the-murderer.xhtml">The Murderer</a>
</li>
<li>
<a href="text/measles.xhtml">Measles</a>
<ol>
<li>
<a href="text/measles.xhtml#measles-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/measles.xhtml#measles-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/measles.xhtml#measles-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/measles.xhtml#measles-4" epub:type="z3998:roman">IV</a>
</li>
</ol>
</li>
<li>
<a href="text/the-jewess.xhtml">The Jewess</a>
</li>
<li>
<a href="text/le-coq-dor.xhtml" xml:lang="fr">Le Coq d’Or</a>
</li>
<li>
<a href="text/sulamith.xhtml">Sulamith</a>
<ol>
<li>
<a href="text/sulamith.xhtml#sulamith-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-4" epub:type="z3998:roman">IV</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-5" epub:type="z3998:roman">V</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-6" epub:type="z3998:roman">VI</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-7" epub:type="z3998:roman">VII</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-8" epub:type="z3998:roman">VIII</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-9" epub:type="z3998:roman">IX</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-10" epub:type="z3998:roman">X</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-11" epub:type="z3998:roman">XI</a>
</li>
<li>
<a href="text/sulamith.xhtml#sulamith-12" epub:type="z3998:roman">XII</a>
</li>
</ol>
</li>
<li>
<a href="text/the-piebald-horses.xhtml">The Piebald Horses</a>
</li>
<li>
<a href="text/the-little-red-christmas-tree.xhtml">The Little Red Christmas Tree</a>
</li>
<li>
<a href="text/monte-carlo.xhtml">Monte Carlo</a>
</li>
<li>
<a href="text/roach-hole.xhtml">Roach Hole</a>
</li>
<li>
<a href="text/the-disciple.xhtml">The Disciple</a>
<ol>
<li>
<a href="text/the-disciple.xhtml#the-disciple-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-disciple.xhtml#the-disciple-2" epub:type="z3998:roman">II</a>
</li>
<li>
<a href="text/the-disciple.xhtml#the-disciple-3" epub:type="z3998:roman">III</a>
</li>
<li>
<a href="text/the-disciple.xhtml#the-disciple-4" epub:type="z3998:roman">IV</a>
</li>
</ol>
</li>
<li>
<a href="text/the-old-city-of-marseilles.xhtml">The Old City of Marseilles</a>
<ol>
<li>
<a href="text/the-old-city-of-marseilles.xhtml#the-old-city-of-marseilles-1" epub:type="z3998:roman">I</a>
</li>
<li>
<a href="text/the-old-city-of-marseilles.xhtml#the-old-city-of-marseilles-2" epub:type="z3998:roman">II</a>
</li>
</ol>
</li>
</ol>
</li>
<li>
<a href="text/endnotes.xhtml">Endnotes</a>
</li>
<li>
<a href="text/colophon.xhtml">Colophon</a>
</li>
<li>
<a href="text/uncopyright.xhtml">Uncopyright</a>
</li>
</ol>
</nav>
<nav id="landmarks" epub:type="landmarks">
<h2 epub:type="title">Landmarks</h2>
<ol>
<li>
<a href="text/the-river-of-life.xhtml" epub:type="bodymatter">Short Fiction</a>
</li>
<li>
<a href="text/endnotes.xhtml" epub:type="backmatter endnotes">Endnotes</a>
</li>
</ol>
</nav>
</body>
</html>
| 35.055901 | 214 | 0.530829 |
9970a7c21ddc9d0f3d8215c690281dbf3b2ec796 | 4,249 | c | C | Sviluppo_software_in_gruppi_di_lavoro_complessi/Esercizi_Eiffel/Eiffel User Files/19.05/precomp/spec/windows/EIFGENs/base-scoop-safe/W_code/C17/ty533d.c | katema-official/Universita_magistrale_anno_1.1 | ee63415b8a4e9b34f704f253a272d0f0a8c247a4 | [
"MIT"
] | null | null | null | Sviluppo_software_in_gruppi_di_lavoro_complessi/Esercizi_Eiffel/Eiffel User Files/19.05/precomp/spec/windows/EIFGENs/base-scoop-safe/W_code/C17/ty533d.c | katema-official/Universita_magistrale_anno_1.1 | ee63415b8a4e9b34f704f253a272d0f0a8c247a4 | [
"MIT"
] | null | null | null | Sviluppo_software_in_gruppi_di_lavoro_complessi/Esercizi_Eiffel/Eiffel User Files/19.05/precomp/spec/windows/EIFGENs/base-scoop-safe/W_code/C17/ty533d.c | katema-official/Universita_magistrale_anno_1.1 | ee63415b8a4e9b34f704f253a272d0f0a8c247a4 | [
"MIT"
] | null | null | null | /*
* Class reference TYPED_POINTER [INTEGER_32]
*/
#include "eif_macros.h"
#ifdef __cplusplus
extern "C" {
#endif
static const EIF_TYPE_INDEX egt_0_533 [] = {0xFF01,232,0xFFFF};
static const EIF_TYPE_INDEX egt_1_533 [] = {0xFF01,533,532,218,0xFFFF};
static const EIF_TYPE_INDEX egt_2_533 [] = {0xFF01,532,218,0xFFFF};
static const EIF_TYPE_INDEX egt_3_533 [] = {0,0xFFFF};
static const EIF_TYPE_INDEX egt_4_533 [] = {0,0xFFFF};
static const EIF_TYPE_INDEX egt_5_533 [] = {0xFF01,532,218,0xFFFF};
static const EIF_TYPE_INDEX egt_6_533 [] = {0xFF01,532,218,0xFFFF};
static const EIF_TYPE_INDEX egt_7_533 [] = {0,0xFFFF};
static const EIF_TYPE_INDEX egt_8_533 [] = {0xFF01,14,0xFFFF};
static const EIF_TYPE_INDEX egt_9_533 [] = {0xFF01,232,0xFFFF};
static const EIF_TYPE_INDEX egt_10_533 [] = {0xFF01,232,0xFFFF};
static const EIF_TYPE_INDEX egt_11_533 [] = {0xFF01,15,0xFFFF};
static const EIF_TYPE_INDEX egt_12_533 [] = {0xFF01,532,218,0xFFFF};
static const EIF_TYPE_INDEX egt_13_533 [] = {0xFF01,532,218,0xFFFF};
static const EIF_TYPE_INDEX egt_14_533 [] = {0xFF01,226,0xFFFF};
static const EIF_TYPE_INDEX egt_15_533 [] = {0xFFF8,1,0xFFFF};
static const struct desc_info desc_533[] = {
{EIF_GENERIC(NULL), 0xFFFFFFFF, 0xFFFFFFFF},
{EIF_GENERIC(egt_0_533), 0, 0xFFFFFFFF},
{EIF_GENERIC(egt_1_533), 1, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 2, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 3, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 12868, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 5, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 6, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 7, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 8, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 9, 0xFFFFFFFF},
{EIF_GENERIC(egt_2_533), 10, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 11, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12, 0xFFFFFFFF},
{EIF_GENERIC(egt_3_533), 13, 0xFFFFFFFF},
{EIF_GENERIC(egt_4_533), 14, 0xFFFFFFFF},
{EIF_GENERIC(egt_5_533), 15, 0xFFFFFFFF},
{EIF_GENERIC(egt_6_533), 16, 0xFFFFFFFF},
{EIF_GENERIC(egt_7_533), 17, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 18, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 19, 0xFFFFFFFF},
{EIF_GENERIC(egt_8_533), 20, 0xFFFFFFFF},
{EIF_GENERIC(egt_9_533), 12883, 0xFFFFFFFF},
{EIF_GENERIC(egt_10_533), 22, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 23, 0xFFFFFFFF},
{EIF_GENERIC(egt_11_533), 24, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 25, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 26, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 27, 0xFFFFFFFF},
{EIF_GENERIC(egt_12_533), 28, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 29, 0xFFFFFFFF},
{EIF_GENERIC(egt_13_533), 30, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 1069, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 1070, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 1071, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01B5 /*218*/), 12866, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 12870, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12865, 0},
{EIF_GENERIC(NULL), 12867, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 12869, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0197 /*203*/), 12871, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12872, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12873, 0xFFFFFFFF},
{EIF_GENERIC(egt_14_533), 12874, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01B5 /*218*/), 12875, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12876, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12877, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12878, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12879, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12880, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12881, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12882, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12884, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12885, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12886, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01B5 /*218*/), 12887, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12888, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12889, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 12890, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12891, 0xFFFFFFFF},
{EIF_GENERIC(egt_15_533), 0x00, 0xFFFFFFFF},
};
void Init533(void)
{
IDSC(desc_533, 0, 532);
IDSC(desc_533 + 1, 1, 532);
IDSC(desc_533 + 32, 40, 532);
IDSC(desc_533 + 35, 260, 532);
IDSC(desc_533 + 37, 106, 532);
IDSC(desc_533 + 60, 10, 532);
}
#ifdef __cplusplus
}
#endif
| 39.71028 | 71 | 0.7237 |
e9a58c6bcfc31de743ef010f3ed95b0be1730073 | 1,022 | rs | Rust | examples/i2c_detect.rs | no111u3/m48_robo_rust | 9b85b334b50808d2c47894d10a2369f1e57c92e4 | [
"Apache-2.0"
] | 2 | 2020-12-08T10:22:43.000Z | 2021-12-16T10:00:53.000Z | examples/i2c_detect.rs | no111u3/m48_robo_rust | 9b85b334b50808d2c47894d10a2369f1e57c92e4 | [
"Apache-2.0"
] | null | null | null | examples/i2c_detect.rs | no111u3/m48_robo_rust | 9b85b334b50808d2c47894d10a2369f1e57c92e4 | [
"Apache-2.0"
] | null | null | null | #![no_std]
#![no_main]
extern crate panic_halt;
use m48_robo_rust::{hal::i2c, prelude::*};
#[m48_robo_rust::entry]
fn main() -> ! {
let dp = m48_robo_rust::Peripherals::take().unwrap();
let mut pinsd = dp.PORTD.split();
let mut pinsc = dp.PORTC.split();
let mut serial = m48_robo_rust::Serial::new(
dp.USART0,
pinsd.pd0,
pinsd.pd1.into_output(&mut pinsd.ddr),
2400,
);
let mut i2c = m48_robo_rust::I2c::new(
dp.TWI,
pinsc.pc4.into_pull_up_input(&mut pinsc.ddr),
pinsc.pc5.into_pull_up_input(&mut pinsc.ddr),
50000,
);
ufmt::uwriteln!(&mut serial, "I2C detect from ATmega48P!\r").void_unwrap();
ufmt::uwriteln!(&mut serial, "Write direction test:\r").void_unwrap();
i2c.i2cdetect(&mut serial, i2c::Direction::Write)
.void_unwrap();
ufmt::uwriteln!(&mut serial, "\r\nRead direction test:\r").void_unwrap();
i2c.i2cdetect(&mut serial, i2c::Direction::Read)
.void_unwrap();
loop {}
}
| 24.926829 | 79 | 0.613503 |
38ba3b93a8d6205f647be94cce4e9f2707e550ab | 11,727 | h | C | config.def.h | OliverLew/dwm | a7b57b17d0c9278ab08a1290d3381fdf2876ebb6 | [
"MIT"
] | 9 | 2020-12-07T22:20:12.000Z | 2022-01-31T15:23:47.000Z | config.def.h | OliverLew/dwm | a7b57b17d0c9278ab08a1290d3381fdf2876ebb6 | [
"MIT"
] | null | null | null | config.def.h | OliverLew/dwm | a7b57b17d0c9278ab08a1290d3381fdf2876ebb6 | [
"MIT"
] | 2 | 2021-07-10T18:19:52.000Z | 2022-03-09T18:18:05.000Z | /* See LICENSE file for copyright and license details. */
/* appearance */
static unsigned int borderpx = 1; /* border pixel of windows */
static int gappx = 16; /* gaps between windows */
static int gapsingle = 1; /* gaps when there is only 1 window */
static unsigned int snap = 32; /* snap pixel */
static int showbar = 1; /* 0 means no bar */
static int topbar = 1; /* 0 means bottom bar */
static int barheightmin = 24; /* minimum height if > 0 */
static const char *fonts[] = {
"monospace:size=11:style=Medium",
"JoyPixels:size=11",
"Noto Sans CJK SC:size=11:style=Medium",
"Material Design Icons:size=13"
};
static int barpaddingh = 2; /* horizontal padding for statusbar */
static int barpaddingtop = 2; /* top padding for statusbar */
static int barpaddingbottom = 0; /* bottom padding for statusbar */
static char foreground[] = "#000000";
static char background[] = "#ffffff";
static char color0[] = "#000000";
static char color1[] = "#AA0000";
static char color2[] = "#00AA00";
static char color3[] = "#AAAA00";
static char color4[] = "#0000AA";
static char color5[] = "#AA00AA";
static char color6[] = "#00AAAA";
static char color7[] = "#AAAAAA";
static char color8[] = "#555555";
static char color9[] = "#FF5555";
static char color10[] = "#55FF55";
static char color11[] = "#FFFF55";
static char color12[] = "#5555FF";
static char color13[] = "#FF55FF";
static char color14[] = "#55FFFF";
static char color15[] = "#FFFFFF";
static const char *base_colors[] = {
color0, color1, color2, color3, color4, color5, color6, color7,
color8, color9, color10, color11, color12, color13, color14, color15
};
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { foreground, background, color0 },
[SchemeSel] = { color6, background, color6 },
};
/* tagging */
static const char *tags[] = { "", "", "", "", "" };
static const char *tags_busy[] = { "", "", "", "", "" };
static const char *tags_curr[] = { "", "", "", "", "" };
static const char pdfpc[] = "pdfpc - presentation";
static const Rule rules[] = {
/* class instance title tags center float sticky monitor nofocus */
{ "firefox", NULL, NULL, 1 << 1, 0, 0, 0, -1, 0 },
{ "firefox", "Toolkit", NULL, 1 << 1, 0, 1, 1, -1, 0 },
{ "firefox", "Browser", NULL, 1 << 1, 1, 1, 0, -1, 0 },
{ "Arandr", NULL, NULL, 0, 1, 1, 0, -1, 0 },
{ "Peek", NULL, NULL, 0, 1, 1, 0, -1, 0 },
{ "floating", NULL, NULL, 0, 1, 1, 0, -1, 0 },
{ "stalonetray", NULL, NULL, 0, 0, 1, 1, -1, 1 },
{ NULL, NULL, pdfpc, 0, 0, 0, 0, 1, 0 },
};
/* layout(s) */
static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static int nmaster = 1; /* number of clients in master area */
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "", tile }, /* first entry is default */
{ "", monocle },
{ "", grid },
{ "", centeredmaster },
{ "", NULL }, /* no layout function means floating behavior */
};
/* These symbols will replace the monocle symbol with corresponding client count */
static const char *monocle_n[] = { "", "", "", "", "", "", "", "", "", "" };
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* commands spawned when clicking statusbar, the mouse button pressed is exported as BUTTON */
static char *statuscmds[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
static char *statuscmd[] = { "dwm-status", NULL, NULL };
static char *dmenucmd[] = { "dmenu_run", NULL };
/*
* Xresources preferences to load at startup
*/
ResourcePref resources[] = {
{ "borderpx", INTEGER, &borderpx },
{ "gappx", INTEGER, &gappx },
{ "gapsingle", INTEGER, &gapsingle },
{ "snap", INTEGER, &snap },
{ "showbar", INTEGER, &showbar },
{ "topbar", INTEGER, &topbar },
{ "barheight", INTEGER, &barheightmin },
{ "foreground", STRING, &foreground },
{ "background", STRING, &background },
{ "color0", STRING, &color0 },
{ "color1", STRING, &color1 },
{ "color2", STRING, &color2 },
{ "color3", STRING, &color3 },
{ "color4", STRING, &color4 },
{ "color5", STRING, &color5 },
{ "color6", STRING, &color6 },
{ "color7", STRING, &color7 },
{ "color8", STRING, &color8 },
{ "color9", STRING, &color9 },
{ "color10", STRING, &color10 },
{ "color11", STRING, &color11 },
{ "color12", STRING, &color12 },
{ "color13", STRING, &color13 },
{ "color14", STRING, &color14 },
{ "color15", STRING, &color15 },
{ "nmaster", INTEGER, &nmaster },
{ "resizehints", INTEGER, &resizehints },
{ "mfact", FLOAT, &mfact },
};
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_x, spawn, {.v = dmenucmd} },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_h, incnmaster, {.i = +1 } },
{ MODKEY|ShiftMask, XK_l, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ControlMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Escape, view, {0} },
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_g, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_6, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_7, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_8, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_9, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, cyclelayout, {.i = +1 } },
{ MODKEY|ShiftMask, XK_space, cyclelayout, {.i = -1 } },
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
{ MODKEY, XK_f, togglefullscr, {0} },
{ MODKEY, XK_s, togglesticky, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, shiftview, {.i = -1 } },
{ MODKEY, XK_period, shiftview, {.i = +1 } },
{ MODKEY, XK_Up, focusstack, {.i = -1 } },
{ MODKEY, XK_Down, focusstack, {.i = +1 } },
{ MODKEY, XK_Left, shiftview, {.i = -1 } },
{ MODKEY, XK_Right, shiftview, {.i = +1 } },
{ MODKEY|ControlMask, XK_comma, focusmon, {.i = -1 } },
{ MODKEY|ControlMask, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask|ControlMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask|ControlMask, XK_period, tagmon, {.i = +1 } },
{ MODKEY|ControlMask, XK_minus, setgaps, {.i = -24 } },
{ MODKEY|ControlMask, XK_equal, setgaps, {.i = +24 } },
{ MODKEY|ControlMask, XK_0, setgaps, {.i = 0 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ShiftMask, XK_r, quit, {1} },
};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1 } },
{ ClkLtSymbol, 0, Button3, cyclelayout, {.i = -1 } },
{ ClkLtSymbol, 0, Button4, cyclelayout, {.i = -1 } },
{ ClkLtSymbol, 0, Button5, cyclelayout, {.i = +1 } },
{ ClkWinTitle, 0, Button3, zoom, {0} },
{ ClkWinTitle, 0, Button4, focusstack, {.i = -1 } },
{ ClkWinTitle, 0, Button5, focusstack, {.i = +1 } },
{ ClkStatusText, 0, Button1, spawn, {.v = statuscmd } },
{ ClkStatusText, 0, Button2, spawn, {.v = statuscmd } },
{ ClkStatusText, 0, Button3, spawn, {.v = statuscmd } },
{ ClkStatusText, 0, Button4, spawn, {.v = statuscmd } },
{ ClkStatusText, 0, Button5, spawn, {.v = statuscmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button2, tag, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, 0, Button4, shiftview, {.i = -1 } },
{ ClkTagBar, 0, Button5, shiftview, {.i = +1 } },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
| 55.578199 | 111 | 0.436685 |
aadc6aba272130bc613b7b73a40088e591565866 | 279 | sql | SQL | src/main/resources/sql/001_init.sql | BogdanJava/url-cutter | 182d35bb1906c569f548ca8e9af8533c14c188a6 | [
"Unlicense"
] | null | null | null | src/main/resources/sql/001_init.sql | BogdanJava/url-cutter | 182d35bb1906c569f548ca8e9af8533c14c188a6 | [
"Unlicense"
] | null | null | null | src/main/resources/sql/001_init.sql | BogdanJava/url-cutter | 182d35bb1906c569f548ca8e9af8533c14c188a6 | [
"Unlicense"
] | null | null | null | BEGIN TRANSACTION;
DROP TABLE IF EXISTS "links" CASCADE;
DROP SEQUENCE IF EXISTS "links_seq" CASCADE;
CREATE SEQUENCE "links_seq" START 100000;
CREATE TABLE "links" (
"id" BIGINT PRIMARY KEY DEFAULT "nextval"('"links_seq"'),
"text" VARCHAR(255) NOT NULL
);
END TRANSACTION | 23.25 | 59 | 0.741935 |
d529e9dc3687e780d6316df2b8b32750b17eccb3 | 1,087 | kt | Kotlin | api/coroutines/v1.5.4/src/commonMain/kotlin/dev/whyoleg/ktd/api/account/DeleteAccount.kt | whyoleg/ktd | 7284eeabef0bd002dc72634351ab751b048900e9 | [
"Apache-2.0"
] | 46 | 2019-09-20T06:25:17.000Z | 2022-02-03T14:36:55.000Z | api/coroutines/v1.5.4/src/commonMain/kotlin/dev/whyoleg/ktd/api/account/DeleteAccount.kt | AlekseyDryuk/ktd | c299dab2b581466e3c9f103ebbacc92dcb18f957 | [
"Apache-2.0"
] | 7 | 2020-04-05T15:07:13.000Z | 2021-05-13T14:38:19.000Z | api/coroutines/v1.5.4/src/commonMain/kotlin/dev/whyoleg/ktd/api/account/DeleteAccount.kt | AlekseyDryuk/ktd | c299dab2b581466e3c9f103ebbacc92dcb18f957 | [
"Apache-2.0"
] | 15 | 2019-11-27T14:23:51.000Z | 2021-12-08T23:06:28.000Z | @file:Suppress(
"unused"
)
@file:UseExperimental(
BotsOnly::class,
TestingOnly::class
)
package dev.whyoleg.ktd.api.account
import dev.whyoleg.ktd.*
import dev.whyoleg.ktd.api.*
import dev.whyoleg.ktd.api.TdApi.*
/**
* Deletes the account of the current user, deleting all information associated with the user from the server
* The phone number of the account can be used to create a new account
* Can be called before authorization when the current authorization state is authorizationStateWaitPassword
*
* @reason - The reason why the account was deleted
*/
suspend fun TelegramClient.deleteAccount(
reason: String? = null
): Ok = account(
DeleteAccount(
reason
)
)
/**
* Deletes the account of the current user, deleting all information associated with the user from the server
* The phone number of the account can be used to create a new account
* Can be called before authorization when the current authorization state is authorizationStateWaitPassword
*/
suspend fun TelegramClient.account(
f: DeleteAccount
): Ok = exec(f) as Ok
| 28.605263 | 109 | 0.74793 |
40d1d5cd8d14a2cabaebf191cbf78f333593ee15 | 3,198 | py | Python | jobs/TEST/SCH_Sheet_job.py | bibinvasudev/EBI_Project | df2560139e463d68a37e67e0bb683c06fa9ef91b | [
"CNRI-Python"
] | null | null | null | jobs/TEST/SCH_Sheet_job.py | bibinvasudev/EBI_Project | df2560139e463d68a37e67e0bb683c06fa9ef91b | [
"CNRI-Python"
] | null | null | null | jobs/TEST/SCH_Sheet_job.py | bibinvasudev/EBI_Project | df2560139e463d68a37e67e0bb683c06fa9ef91b | [
"CNRI-Python"
] | null | null | null | # Author : bibin
# Date : 09/20/2018
# Description : Sample Usage of SCH Sheet Job [Reading from Worksheet-XLSX(Source) save/load to Oracle(Target)]
# Importing required Lib
import logging
from time import gmtime, strftime
import py4j
from dependencies.spark import start_spark
from dependencies.EbiReadWrite import EbiReadWrite
# Spark logging
logger = logging.getLogger(__name__)
# appName --> Name of the Job (AppName for Spark application)
app_name = 'SCH_SHEET_JOB'
# Sheet file name
fileName = '/home/spark/v_kumbakonam/Partner_Details.xlsx'
# Sheet option
useHeader = 'true'
inferSchema = 'true'
sheetName = 'Partner Summary'
# DB prop Key of target DB
db_prop_key_load = 'EBI_EDW'
# targetTableName
targetTableName = 'DIMS.SP_ES_SYSTEM_DISK_MODEL'
# DB property filename with path
propertyFile = '/home/spark/configFiles/project.properties'
#propertyFile = sys.argsv[0]
timeStamp =strftime('%Y%m%d', gmtime())
logFilename = app_name + '_' + timeStamp + '.log'
startDate=strftime('%Y-%m-%d %H:%M:%S', gmtime())
endDate=strftime('%Y-%m-%d %H:%M:%S', gmtime())
srcCount = '0'
destCount = '0'
# Main method
def main():
try:
"""Main ETL script definition.
:return: None
"""
src_count = '0'
dest_count = '0'
# start Spark application and get Spark session, logger and config
spark, config = start_spark(
app_name='my_etl_job',
files=['configs/etl_config.json'])
# log that main ETL job is starting
# log.warn('SCH_job is up-and-running')
# Create class Object
Ebi_read_write_obj = EbiReadWrite(app_name,spark,config,logger)
# Calling Job Class method --> loadWorksheetData()
dataFrame = Ebi_read_write_obj.extract_data_worksheet(fileName,sheetName,useHeader,inferSchema)
dataFrame.show(5)
srcCount = str(dataFrame.count())
# Calling Job Class method --> saveDataOracle()
Ebi_read_write_obj.load_data_oracle(dataFrame,targetTableName,'overwrite',db_prop_key_load)
# getTargetDataCount
destCount = str(Ebi_read_write_obj.get_target_data_count(targetTableName,db_prop_key_load))
logDataFormat = startDate +' | '+app_name+' | '+ srcCount +' | '+destCount+' | '+endDate+' | %(message)s'
Ebi_read_write_obj.create_log(logDataFormat,logFilename,logger)
logger.info("success")
except py4j.protocol.Py4JJavaError:
# Write exception (if any) in Log file
logDataExp = startDate +' | '+ app_name +' | '+ srcCount +' | ' + destCount + ' | '+endDate+' | %(message)s'
Ebi_read_write_obj.create_log(logDataExp,logger,logFilename)
except Exception as err:
# Write expeption in spark log or console
logger.error('\n __main__ SCH_job --> Exception-Traceback :: ' + str(err))
raise
# Entry point for script
if __name__ == '__main__':
# Calling main() method
main()
| 32.632653 | 120 | 0.626329 |
e0bad08e98c48a1e2ec55de29a6587496c7d146c | 1,906 | kt | Kotlin | reader/src/main/java/com/iniongun/tivbible/reader/utils/DashedUnderlineSpan.kt | IniongunIsaac/Tiv-Bible | 63da6ec716325a23b24d7071e53d5845ba56fa3c | [
"MIT"
] | 7 | 2019-12-31T14:51:15.000Z | 2020-05-29T22:08:39.000Z | reader/src/main/java/com/iniongun/tivbible/reader/utils/DashedUnderlineSpan.kt | MbaiorgaG/Tiv-Bible | 63da6ec716325a23b24d7071e53d5845ba56fa3c | [
"MIT"
] | null | null | null | reader/src/main/java/com/iniongun/tivbible/reader/utils/DashedUnderlineSpan.kt | MbaiorgaG/Tiv-Bible | 63da6ec716325a23b24d7071e53d5845ba56fa3c | [
"MIT"
] | 3 | 2020-06-02T11:33:15.000Z | 2022-01-12T02:15:50.000Z | package com.iniongun.tivbible.reader.utils
import android.graphics.Canvas
import android.graphics.DashPathEffect
import android.graphics.Paint
import android.text.Layout
import android.text.style.LineBackgroundSpan
import android.text.style.LineHeightSpan
import android.widget.TextView
/**
* Created by Isaac Iniongun on 30/04/2020.
* For Tiv Bible project.
*/
class DashedUnderlineSpan(
textView: TextView, color: Int, thickness: Float, dashPath: Float,
offsetY: Float, spacingExtra: Float
) :
LineBackgroundSpan, LineHeightSpan {
private val paint: Paint
private val textView: TextView
private val offsetY: Float
private val spacingExtra: Int
override fun chooseHeight(
text: CharSequence?, start: Int, end: Int, spanstartv: Int, v: Int,
fm: Paint.FontMetricsInt
) {
fm.ascent -= spacingExtra
fm.top -= spacingExtra
fm.descent += spacingExtra
fm.bottom += spacingExtra
}
override fun drawBackground(
canvas: Canvas, p: Paint?, left: Int, right: Int, top: Int, baseline: Int,
bottom: Int, text: CharSequence?, start: Int, end: Int, lnum: Int
) {
val lineNum = textView.lineCount
for (i in 0 until lineNum) {
val layout: Layout = textView.layout
canvas.drawLine(
layout.getLineLeft(i), layout.getLineBottom(i) - spacingExtra + offsetY,
layout.getLineRight(i), layout.getLineBottom(i) - spacingExtra + offsetY,
paint
)
}
}
init {
paint = Paint()
paint.setColor(color)
paint.setStyle(Paint.Style.STROKE)
paint.setPathEffect(DashPathEffect(floatArrayOf(dashPath, dashPath), 0f))
paint.setStrokeWidth(thickness)
this.textView = textView
this.offsetY = offsetY
this.spacingExtra = spacingExtra.toInt()
}
} | 31.245902 | 89 | 0.656348 |
9e2a73317dda7f73f09a5c454321aaefadfda815 | 480 | sql | SQL | app/lib/db_query/sql/tweets/enca/profiles.sql | MichaelCurrin/twitterverse | 9629f848377e4346be833db70f11c593cc0d7b6c | [
"MIT"
] | 10 | 2019-03-22T07:07:41.000Z | 2022-01-26T00:57:45.000Z | app/lib/db_query/sql/tweets/enca/profiles.sql | MichaelCurrin/twitterverse | 9629f848377e4346be833db70f11c593cc0d7b6c | [
"MIT"
] | 70 | 2017-07-12T19:49:38.000Z | 2020-09-02T10:03:28.000Z | app/lib/db_query/sql/tweets/enca/profiles.sql | MichaelCurrin/twitterverse | 9629f848377e4346be833db70f11c593cc0d7b6c | [
"MIT"
] | 2 | 2017-06-30T07:13:39.000Z | 2020-12-04T00:39:12.000Z | SELECT
'@' || profile.screen_name AS screen_name,
profile.name,
profile.followers_count,
profile.location,
profile.image_url,
COUNT(*) AS cnt
FROM tweet
INNER JOIN profile ON tweet.profile_id = profile.id
INNER JOIN tweet_campaign ON tweet.id = tweet_campaign.tweet_id
INNER JOIN campaign ON campaign.id = tweet_campaign.campaign_id
WHERE campaign.name = 'ENCA'
-- AND followers_count > 100000
GROUP BY screen_name
-- HAVING cnt > 10
ORDER BY cnt DESC
| 28.235294 | 63 | 0.745833 |
9651c476fce4a127225d0d7e8624ec51cf9b3378 | 3,755 | php | PHP | resources/views/master.blade.php | syazwanirahimin/APPXILON | 1221e4f993ddd1111ff3b21ef33107b9c7421a7d | [
"MIT"
] | null | null | null | resources/views/master.blade.php | syazwanirahimin/APPXILON | 1221e4f993ddd1111ff3b21ef33107b9c7421a7d | [
"MIT"
] | null | null | null | resources/views/master.blade.php | syazwanirahimin/APPXILON | 1221e4f993ddd1111ff3b21ef33107b9c7421a7d | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initioal-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>AppXilon</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Free Website Template" name="keywords">
<meta content="Free Website Template" name="description">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<!-- Favicon -->
<link href="{{asset('asset/img/favicon.ico')}}" rel="icon">
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400|Nunito:600,700" rel="stylesheet">
<!-- CSS Libraries -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
<link href="{{asset('asset/lib/animate/animate.min.css')}}" rel="stylesheet">
<link href="{{asset('asset/lib/owlcarousel.min.css')}}" rel="stylesheet">
<link href="{{asset('asset/lib/flaticon/font/flaticon.css')}}" rel="stylesheet">
<link href="{{asset('asset/lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css')}}" rel="stylesheet" />
<!-- Template Stylesheet -->
<link href="{{asset('asset/css/style.css')}}" rel="stylesheet">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<!-- JQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- dialogflow -->
<script src="https://www.gstatic.com/dialogflow-console/fast/messenger/bootstrap.js?v=1"></script>
<df-messenger
intent="WELCOME"
chat-title="Sarah"
agent-id="0d231246-41c8-400f-b19f-c5eeec2fd56b"
language-code="en"
></df-messenger>
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body>
{{View::make('header')}}
@yield('content')
{{View::make('footer')}}
@yield('scripts')
<a href="#" class="back-to-top"><i class="fa fa-chevron-up"></i></a>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="{{asset('asset/lib/easing/easing.min.js')}}"></script>
<script src="{{asset('asset/lib/owlcarousel/owl.carousel.min.js')}}"></script>
<script src="{{asset('asset/lib/tempusdominus/js/moment.min.js')}}"></script>
<script src="{{asset('asset/lib/tempusdominus/js/moment-timezone.min.js')}}"></script>
<script src="{{asset('asset/lib/tempusdominus/js/tempusdominus-bootstrap-4.min.js')}}"></script>
<!-- Contact Javascript File -->
<script src="{{asset('asset/mail/jqBootstrapValidation.min.js')}}"></script>
<script src="{{asset('asset/mail/contact.js')}}"></script>
<!-- Template Javascript -->
<script src="{{asset('asset/js/main.js')}}"></script>
<script src="{{asset('asset/js/checkout.js')}}"></script>
</body>
</html> | 44.176471 | 212 | 0.671372 |
df837b14573571c71112324b8acf6b568a417707 | 540 | ts | TypeScript | eventapp/ClientApp/app/services/priority.service.ts | mia01/eVent | b472b9011e3d3ce94428e5dd169c31e74f37d899 | [
"Apache-2.0"
] | null | null | null | eventapp/ClientApp/app/services/priority.service.ts | mia01/eVent | b472b9011e3d3ce94428e5dd169c31e74f37d899 | [
"Apache-2.0"
] | null | null | null | eventapp/ClientApp/app/services/priority.service.ts | mia01/eVent | b472b9011e3d3ce94428e5dd169c31e74f37d899 | [
"Apache-2.0"
] | null | null | null | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../environments/environment';
import Priority from '../models/priority';
@Injectable({
providedIn: 'root'
})
export class PriorityService {
private PRIORITY_URL = environment.api.base + environment.api.priorities;
constructor(
private httpClient: HttpClient
) { }
public getAllPriorities(): Promise<Priority[]> {
return this.httpClient.get<Priority[]>(this.PRIORITY_URL).toPromise();
}
}
| 24.545455 | 75 | 0.714815 |
c35ef465ffa6077d99e23b759e4c21e66b54feff | 801 | go | Go | timelog/utils.go | qbart/timelog | 27589c1f997ac07ba56bbbcc8b44bdc16ef5d14d | [
"MIT"
] | 11 | 2020-02-03T20:32:50.000Z | 2021-11-15T08:38:02.000Z | timelog/utils.go | qbart/timelog | 27589c1f997ac07ba56bbbcc8b44bdc16ef5d14d | [
"MIT"
] | 4 | 2020-02-08T08:12:32.000Z | 2020-02-11T17:14:47.000Z | timelog/utils.go | qbart/timelog | 27589c1f997ac07ba56bbbcc8b44bdc16ef5d14d | [
"MIT"
] | null | null | null | package timelog
import (
"time"
)
const (
formatDateTime = "2006-01-02 15:04"
formatDate = "2006-01-02"
formatTime = "15:04"
)
// ParseDateTime parses time in app-default format.
func ParseDateTime(value string) (time.Time, error) {
return time.Parse(formatDateTime, value)
}
// ToLocal converts time to local timezone.
func ToLocal(t time.Time) time.Time {
local, _ := time.LoadLocation("Local")
return t.In(local)
}
// FormatDateTime formats datetime to string.
func FormatDateTime(value time.Time) string {
return value.Format(formatDateTime)
}
// FormatTime formats time to string.
func FormatTime(value time.Time) string {
return value.Format(formatTime)
}
// FormatDate formats date to string.
func FormatDate(value time.Time) string {
return value.Format(formatDate)
}
| 21.078947 | 53 | 0.735331 |
31020f3d6d115f2678257f7d5c003fe6fa0bc97c | 2,724 | kt | Kotlin | app/src/tv/java/app/newproj/lbrytv/ui/error/ErrorFragment.kt | linimin/lbry-androidtv | fd25f231a1c028b36b7a85b7fdbffcff935839c5 | [
"MIT"
] | 13 | 2021-12-03T09:14:22.000Z | 2022-03-30T22:01:39.000Z | app/src/tv/java/app/newproj/lbrytv/ui/error/ErrorFragment.kt | linimin/lbry-androidtv | fd25f231a1c028b36b7a85b7fdbffcff935839c5 | [
"MIT"
] | 2 | 2021-12-15T18:48:02.000Z | 2022-03-30T22:01:10.000Z | app/src/tv/java/app/newproj/lbrytv/ui/error/ErrorFragment.kt | linimin/lbry-androidtv | fd25f231a1c028b36b7a85b7fdbffcff935839c5 | [
"MIT"
] | 1 | 2022-01-16T17:48:55.000Z | 2022-01-16T17:48:55.000Z | /*
* MIT License
*
* Copyright (c) 2022 LIN I MIN
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package app.newproj.lbrytv.ui.error
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.setFragmentResult
import androidx.fragment.app.viewModels
import androidx.leanback.app.ErrorSupportFragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import app.newproj.lbrytv.R
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
@AndroidEntryPoint
class ErrorFragment : ErrorSupportFragment() {
private val viewModel: ErrorViewModel by viewModels()
private val navController by lazy { findNavController() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
imageDrawable = ContextCompat.getDrawable(requireContext(), R.drawable.error_outline)
buttonText = getString(R.string.close)
setButtonClickListener {
viewModel.uiState.value.requestKey?.let {
setFragmentResult(it, Bundle.EMPTY)
}
navController.popBackStack()
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewLifecycleOwner.lifecycleScope.launch {
viewModel.uiState
.flowWithLifecycle(viewLifecycleOwner.lifecycle, Lifecycle.State.STARTED)
.collect {
message = it.message
}
}
}
}
| 39.478261 | 93 | 0.73862 |
83f3f616e00d71707946f1e0d1d14ceaebbf957d | 5,146 | go | Go | client/clinet_mock.go | DoomSentinel/scheduler | 1427ac778b8ffc7ed2f0593abaae2bbab970c6a8 | [
"MIT"
] | null | null | null | client/clinet_mock.go | DoomSentinel/scheduler | 1427ac778b8ffc7ed2f0593abaae2bbab970c6a8 | [
"MIT"
] | null | null | null | client/clinet_mock.go | DoomSentinel/scheduler | 1427ac778b8ffc7ed2f0593abaae2bbab970c6a8 | [
"MIT"
] | null | null | null | // Code generated by MockGen. DO NOT EDIT.
// Source: github.com/DoomSentinel/scheduler-api/gen/go/v1 (interfaces: SchedulerServiceClient)
// Package client is a generated GoMock package.
package client
import (
context "context"
scheduler "github.com/DoomSentinel/scheduler-api/gen/go/v1"
gomock "github.com/golang/mock/gomock"
grpc "google.golang.org/grpc"
reflect "reflect"
)
// MockSchedulerServiceClient is a mock of SchedulerServiceClient interface
type MockSchedulerServiceClient struct {
ctrl *gomock.Controller
recorder *MockSchedulerServiceClientMockRecorder
}
// MockSchedulerServiceClientMockRecorder is the mock recorder for MockSchedulerServiceClient
type MockSchedulerServiceClientMockRecorder struct {
mock *MockSchedulerServiceClient
}
// NewMockSchedulerServiceClient creates a new mock instance
func NewMockSchedulerServiceClient(ctrl *gomock.Controller) *MockSchedulerServiceClient {
mock := &MockSchedulerServiceClient{ctrl: ctrl}
mock.recorder = &MockSchedulerServiceClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockSchedulerServiceClient) EXPECT() *MockSchedulerServiceClientMockRecorder {
return m.recorder
}
// ExecutionNotifications mocks base method
func (m *MockSchedulerServiceClient) ExecutionNotifications(arg0 context.Context, arg1 *scheduler.ExecutionNotificationsRequest, arg2 ...grpc.CallOption) (scheduler.SchedulerService_ExecutionNotificationsClient, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ExecutionNotifications", varargs...)
ret0, _ := ret[0].(scheduler.SchedulerService_ExecutionNotificationsClient)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ExecutionNotifications indicates an expected call of ExecutionNotifications
func (mr *MockSchedulerServiceClientMockRecorder) ExecutionNotifications(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecutionNotifications", reflect.TypeOf((*MockSchedulerServiceClient)(nil).ExecutionNotifications), varargs...)
}
// ScheduleCommandTask mocks base method
func (m *MockSchedulerServiceClient) ScheduleCommandTask(arg0 context.Context, arg1 *scheduler.ScheduleCommandTaskRequest, arg2 ...grpc.CallOption) (*scheduler.ScheduleCommandTaskResponse, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ScheduleCommandTask", varargs...)
ret0, _ := ret[0].(*scheduler.ScheduleCommandTaskResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ScheduleCommandTask indicates an expected call of ScheduleCommandTask
func (mr *MockSchedulerServiceClientMockRecorder) ScheduleCommandTask(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScheduleCommandTask", reflect.TypeOf((*MockSchedulerServiceClient)(nil).ScheduleCommandTask), varargs...)
}
// ScheduleDummyTask mocks base method
func (m *MockSchedulerServiceClient) ScheduleDummyTask(arg0 context.Context, arg1 *scheduler.ScheduleDummyTaskRequest, arg2 ...grpc.CallOption) (*scheduler.ScheduleDummyTaskResponse, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ScheduleDummyTask", varargs...)
ret0, _ := ret[0].(*scheduler.ScheduleDummyTaskResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ScheduleDummyTask indicates an expected call of ScheduleDummyTask
func (mr *MockSchedulerServiceClientMockRecorder) ScheduleDummyTask(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScheduleDummyTask", reflect.TypeOf((*MockSchedulerServiceClient)(nil).ScheduleDummyTask), varargs...)
}
// ScheduleRemoteTask mocks base method
func (m *MockSchedulerServiceClient) ScheduleRemoteTask(arg0 context.Context, arg1 *scheduler.ScheduleRemoteTaskRequest, arg2 ...grpc.CallOption) (*scheduler.ScheduleRemoteTaskResponse, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ScheduleRemoteTask", varargs...)
ret0, _ := ret[0].(*scheduler.ScheduleRemoteTaskResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ScheduleRemoteTask indicates an expected call of ScheduleRemoteTask
func (mr *MockSchedulerServiceClientMockRecorder) ScheduleRemoteTask(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScheduleRemoteTask", reflect.TypeOf((*MockSchedulerServiceClient)(nil).ScheduleRemoteTask), varargs...)
}
| 43.982906 | 220 | 0.772056 |
82d40295467d2351b9a879344991f9697d71479a | 6,784 | sql | SQL | doc/database.sql | acrossmountain/spring-demo-redpack | d6c4ff183e24bd63d3d219924cc57819cb740c98 | [
"Apache-2.0"
] | null | null | null | doc/database.sql | acrossmountain/spring-demo-redpack | d6c4ff183e24bd63d3d219924cc57819cb740c98 | [
"Apache-2.0"
] | null | null | null | doc/database.sql | acrossmountain/spring-demo-redpack | d6c4ff183e24bd63d3d219924cc57819cb740c98 | [
"Apache-2.0"
] | null | null | null | /*
Navicat Premium Data Transfer
Source Server : 本地数据库
Source Server Type : MySQL
Source Server Version : 80012
Source Host : localhost:3306
Source Schema : red_pack
Target Server Type : MySQL
Target Server Version : 80012
File Encoding : 65001
Date: 19/12/2020 10:53:24
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for account
-- ----------------------------
DROP TABLE IF EXISTS `account`;
CREATE TABLE `account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '账户ID',
`account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '账户编号',
`account_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '账户名称',
`account_type` tinyint(2) NOT NULL COMMENT '账户类型',
`currency_code` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'CNY' COMMENT '货币类型',
`user_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '用户编号',
`username` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '用户名称',
`balance` decimal(30, 6) UNSIGNED NULL DEFAULT 0.000000 COMMENT '账户可用余额',
`status` tinyint(2) NOT NULL COMMENT '账户状态: 0账户初始化,1启用,2停用',
`created_at` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`updated_at` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `account_no`(`account_no`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for account_log
-- ----------------------------
DROP TABLE IF EXISTS `account_log`;
CREATE TABLE `account_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`trade_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '交易单号 全局不重复字符或数字,唯一性标识 ',
`log_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '流水编号 全局不重复字符或数字,唯一性标识 ',
`account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账户编号 账户ID',
`target_account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账户编号 账户ID',
`user_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户编号',
`username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名称',
`target_user_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '目标用户编号',
`target_username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '目标用户名称',
`amount` decimal(30, 6) NOT NULL DEFAULT 0.000000 COMMENT '交易金额,该交易涉及的金额 ',
`balance` decimal(30, 6) UNSIGNED NOT NULL DEFAULT 0.000000 COMMENT '交易后余额,该交易后的余额 ',
`change_type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '流水交易类型,0 创建账户,>0 为收入类型,<0 为支出类型,自定义',
`change_flag` tinyint(2) NOT NULL DEFAULT 0 COMMENT '交易变化标识:-1 出账 1为进账,枚举',
`status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '交易状态:',
`decs` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '交易描述 ',
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `id_log_no_idx`(`log_no`) USING BTREE,
INDEX `id_user_idx`(`user_id`) USING BTREE,
INDEX `id_account_idx`(`account_no`) USING BTREE,
INDEX `id_trade_idx`(`trade_no`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for red_envelope_goods
-- ----------------------------
DROP TABLE IF EXISTS `red_envelope_goods`;
CREATE TABLE `red_envelope_goods` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`envelope_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '红包编号,红包唯一标识 ',
`envelope_type` tinyint(2) NOT NULL COMMENT '红包类型:普通红包,碰运气红包,过期红包',
`username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名称',
`user_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户编号, 红包所属用户 ',
`blessing` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '祝福语',
`amount` decimal(30, 6) UNSIGNED NOT NULL DEFAULT 0.000000 COMMENT '红包总金额',
`amount_one` decimal(30, 6) UNSIGNED NOT NULL DEFAULT 0.000000 COMMENT '单个红包金额,碰运气红包无效',
`quantity` int(10) UNSIGNED NOT NULL COMMENT '红包总数量 ',
`remain_amount` decimal(30, 6) UNSIGNED NOT NULL DEFAULT 0.000000 COMMENT '红包剩余金额额',
`remain_quantity` int(10) UNSIGNED NOT NULL COMMENT '红包剩余数量 ',
`expired_at` datetime(3) NOT NULL COMMENT '过期时间',
`status` tinyint(2) NOT NULL COMMENT '红包/订单状态:0 创建、1 发布启用、2过期、3失效',
`order_type` tinyint(2) NOT NULL COMMENT '订单类型:发布单、退款单 ',
`pay_status` tinyint(2) NOT NULL COMMENT '支付状态:未支付,支付中,已支付,支付失败 ',
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `envelope_no_idx`(`envelope_no`) USING BTREE,
INDEX `id_user_idx`(`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1276 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for red_envelope_item
-- ----------------------------
DROP TABLE IF EXISTS `red_envelope_item`;
CREATE TABLE `red_envelope_item` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`item_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '红包订单详情编号 ',
`envelope_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '红包编号,红包唯一标识 ',
`recv_username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '红包接收者用户名称',
`recv_user_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '红包接收者用户编号 ',
`amount` decimal(30, 6) UNSIGNED NOT NULL DEFAULT 0.000000 COMMENT '收到金额',
`quantity` int(10) UNSIGNED NOT NULL COMMENT '收到数量:对于收红包来说是1 ',
`remain_amount` decimal(30, 6) UNSIGNED NOT NULL DEFAULT 0.000000 COMMENT '收到后红包剩余金额',
`account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '红包接收者账户ID',
`pay_status` tinyint(2) NOT NULL COMMENT '支付状态:未支付,支付中,已支付,支付失败 ',
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `item_no_idx`(`item_no`) USING BTREE,
INDEX `envelope_no_idx`(`envelope_no`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
| 57.491525 | 111 | 0.72671 |
859dbe45154a692e8b03109e0b5de77b821cd427 | 494 | js | JavaScript | week-1/2_4_send_transaction.js | CT83/Ethereum-India-Fellowship | 18917a9072d6e82012a6c9ba746e2bc1d844617b | [
"Apache-2.0"
] | null | null | null | week-1/2_4_send_transaction.js | CT83/Ethereum-India-Fellowship | 18917a9072d6e82012a6c9ba746e2bc1d844617b | [
"Apache-2.0"
] | 8 | 2020-07-21T05:14:33.000Z | 2022-02-13T16:23:34.000Z | week-1/2_4_send_transaction.js | CT83/Ethereum-India-Fellowship | 18917a9072d6e82012a6c9ba746e2bc1d844617b | [
"Apache-2.0"
] | null | null | null | const dotenv = require("dotenv");
dotenv.config();
var Web3 = require('web3');
const web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var sendEth = async function () {
var tx = {
from: process.env.ADDRESS,
to: "0xafa3f8684e54059998bc3a7b0d2b0da075154d66",
value: web3.utils.toWei("0.02", "ether")
}
var res = await web3.eth.personal.sendTransaction(tx,process.env.PASSPHRASE,)
console.log(res)
}
sendEth(); | 29.058824 | 81 | 0.674089 |
53a94960933f5095e1a668978c18a709a23a8ba6 | 2,399 | kt | Kotlin | caiguicheng/week01/day03/work/demo03work/controller/UserController.kt | cgc186/work | b4da417e8eeb13d81d44467bd46dca73126625df | [
"AFL-3.0"
] | null | null | null | caiguicheng/week01/day03/work/demo03work/controller/UserController.kt | cgc186/work | b4da417e8eeb13d81d44467bd46dca73126625df | [
"AFL-3.0"
] | null | null | null | caiguicheng/week01/day03/work/demo03work/controller/UserController.kt | cgc186/work | b4da417e8eeb13d81d44467bd46dca73126625df | [
"AFL-3.0"
] | null | null | null | package com.example.demo03work.controller
import com.example.demo03work.entity.Order
import com.example.demo03work.entity.User
import com.example.demo03work.entity.UserData
import com.example.demo03work.service.UserService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.mybatis.spring.annotation.MapperScan
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Lazy
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RestController
import springfox.documentation.swagger2.annotations.EnableSwagger2
/**
*
*/
@Api(tags = ["user"])
@RestController
@EnableSwagger2
//@MapperScan("com.example.demo03work.dao")
class UserController {
//使用时候创建
@Autowired
@Lazy
lateinit var userService: UserService
@ApiOperation("用户添加")
@GetMapping("/addUser")
fun addUser(user: User): Int {
println("id:")
println(user.id)
return userService.insertUser(user)
}
@ApiOperation("删除用户")
@DeleteMapping("/deleteUser")
fun deleteUser(id: Int): Int {
return userService.deleteUser(id)
}
/**
* 根据条件获得用户
* @return 符合条件的用户列表
*/
@ApiOperation("查找用户信息")
@PostMapping("/selectUser")
fun selectUser(user: User): List<User> {
println("time")
println(user.createTime)
return userService.selectUser(user)
}
/**
* 姓名模糊查询
* @return 符合条件的用户列表
*/
@ApiOperation("查找用户信息")
@PostMapping("/selectUserByName")
fun selectUserByName(name: String): List<User> {
return userService.selectUserByName(name)
}
/**
* 时间区间查询
* @return 符合条件的用户列表
*/
@ApiOperation("查找用户信息")
@PostMapping("/selectUserByTime")
fun selectUserByName(time: Order): List<User> {
return userService.selectUserByTime(time)
}
/**
* 显示用户信息列表
* @return 用户列表
*/
@ApiOperation("显示用户信息列表")
@PostMapping("/getUserList")
fun getUserList(): List<UserData> {
return userService.getUserList()
}
@ApiOperation("修改用户信息")
@PostMapping("/updateUser")
fun updateUser(user: User): Int {
return userService.updateUser(user)
}
} | 25.795699 | 66 | 0.690288 |
47431473c5c76f1452c6ea6df9848c726173dff1 | 14,876 | html | HTML | Flask/Before JS/templates/menu.html | inventor321/https---github.com-inventor321-nomadic-tribe | 139896a8f1a3c481b0f306a1c2e3cd9979392bde | [
"MIT"
] | 2 | 2021-11-11T01:07:44.000Z | 2021-11-11T01:07:52.000Z | Flask/Before JS/templates/menu.html | inventor321/Nomad-tribe | 139896a8f1a3c481b0f306a1c2e3cd9979392bde | [
"MIT"
] | null | null | null | Flask/Before JS/templates/menu.html | inventor321/Nomad-tribe | 139896a8f1a3c481b0f306a1c2e3cd9979392bde | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<title>Nomadic Camp</title>
<meta charset=utf-8>
<meta http-equiv="refresh" content=";url=http://127.0.0.1:5000/" /><!------>
<link href="https://fonts.googleapis.com/css?family=Montserrat:700" rel="stylesheet">
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='style.css') }}">
<style>
.WoodResincome{
--u:{{wood}};
--n:{{wood+WW}};
}
.FoodResincome{
--u:{{food}};
--n:{{food+FW}};
}
.LeatherResincome{
--u:{{Leather}};
--n:{{Leather}};
}
</style>
</head>
<body>
<div class="background-chat">
<div class="chat">
{% for msg in chat %}
<h2 class="event">{{ msg }}</h2>
{% endfor %}
</div>
</div>
<h1 style="text-shadow: 0px 0px 5px white;">Nomadic Camp</h1>
<div class="tabs">
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" {{Gcheck}}>
<label for="tab-1">Outside</label>
<div class="content">
<form action="." method="POST">
<div class="progress">
<div class="progress-value"></div>
<div class="value"></div>
<input class="butt" type="submit" value="Gather" name="Gather">
<input class="butth" type="submit" value="Gather" name="Gather" style="visibility: {{replacement}};">
<div class="butthbackground" style="visibility: {{replacement}};"></div>
</div>
</form>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1"{{Ccheck}}>
<label for="tab-2">Camp</label>
<div class="content">
<form action="." method="POST">
<div class="Items">
</div>
<div class="ressources" style="z-index: 10;">
<div class="population">Population : {{population}} / {{populationmax}}</div><div style="position: absolute;left: 190px;">Workers</div><br>
<div class ="income WoodResincome">Wood : </div> <input class="buttons" type="submit" value="+WW" name="+WW"> <div class="workers">{{WW}}</div><input class=" R buttons" type="submit" value="-WW" name="-WW"><br>
<div class ="income FoodResincome">Food : </div><input class=" buttons" type="submit" value="+FW" name="+FW"><div class="workers">{{FW}}</div><input class=" R buttons" type="submit" value="-FW" name="-FW"><br>
<div class ="income LeatherResincome">Leather : </div><br>
</div>
<div class="cta-container sword" style="visibility: {{WSwvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Wooden Sword" name="Wooden Sword">
</div>
</div>
<div class="cta-container sword" style="visibility: {{StoSwvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Stone Sword" name="Stone Sword">
</div>
</div>
<div class="cta-container sword" style="visibility: {{ISwvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Iron Sword" name="Iron Sword">
</div>
</div>
<div class="cta-container sword" style="visibility: {{SteSwvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Steel Sword" name="Steel Sword">
</div>
</div>
<div class="cta-container spear" style="visibility: {{WSpvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Wooden Spear" name="Wooden Spear">
</div>
</div>
<div class="cta-container spear" style="visibility: {{StoSpvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Stone Spear" name="Stone Spear">
</div>
</div>
<div class="cta-container spear" style="visibility: {{ISpvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Iron Spear" name="Iron Spear">
</div>
</div>
<div class="cta-container spear" style="visibility: {{SteSpvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Steel Spear" name="Steel Spear">
</div>
</div>
<div class="cta-container Atlatl" style="visibility: {{Atlatlvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Atlatl" name="Atlatl">
</div>
</div>
<div class="cta-container Sack" style="visibility: {{Sackvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Sack" name="Sack">
</div>
</div>
<div class="cta-container Hut" style="visibility: {{Hutvis}};">
<div class="button">
<div class="square-front">
<div class="relative-box">
<span class="line line-top"></span>
<span class="line line-right"></span>
<span class="line line-bottom"></span>
<span class="line line-left"></span>
</div>
</div>
<input type="submit" class="label" value="Hut" name="Hut">
</div>
</div>
</form>
<div class="firebackground">
<div class="Alight"></div>
<div class="Acontent">
<div class="Afire">
<div class="Abottom"></div>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
<figure></figure>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="goo" />
<feBlend in="SourceGraphic" in2="goo" />
</filter>
</defs>
</svg>
</div>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-3" name="tab-group-1" {{Tcheck}}>
<label for="tab-3">Tab Three</label>
<div class="content">
<a href="/wilderness" class="link"><div class="text" >wilderness</div></a>
<a href="/crystal" class="link" style="display:{{MCdisplay}};"><div class="text" >Magic Crystal</div></a>
<a href="/techtree" class="link" style="display:{{TTdisplay}};"><div class="text" >Tech Tree</div></a>
</div>
</div>
</div>
<div class="exploredarea">World explored : {{exploredarea}} / {{Totalarea}} m <sup>2</sup> ({{percantage}} %)</div>
<div class="location">
<input type="checkbox" id="some-checkbox">
<label for="some-checkbox" id="somecheckbox">X</label>
<div class="checkbox-hack-content">
<div class="otherinfo">
<div class="frame">
<a href="https://github.com/inventor321/nomadic-tribe" class="custom-btn btn-About" style="text-decoration: none; ">Learn More</a>
</div>
</div>
</div>
</div>
</body>
</html>
| 47.832797 | 238 | 0.362597 |
89b2fcf148d4e08b281bb5f84044d0be4bb4e021 | 7,717 | swift | Swift | Green Recipes/Views/HomePage.swift | sreeganeshji/Green-Recipes | 3bce5e6f5847b61ffb06d3b33db291266477be52 | [
"MIT"
] | null | null | null | Green Recipes/Views/HomePage.swift | sreeganeshji/Green-Recipes | 3bce5e6f5847b61ffb06d3b33db291266477be52 | [
"MIT"
] | null | null | null | Green Recipes/Views/HomePage.swift | sreeganeshji/Green-Recipes | 3bce5e6f5847b61ffb06d3b33db291266477be52 | [
"MIT"
] | null | null | null | //
// HomePage.swift
// Green Recipes
//
// Created by SreeGaneshji on 10/30/20.
//
/*
*/
import SwiftUI
import AuthenticationServices
enum tabViews {
case search, settings, favorites, explore, addRecipe
/*
* explore- can be category wise arrangement of the popular dishes based on views this week, last week and so on. We'll figure out.
*/
}
struct HomePage: View {
var localStorageManager = LocalStorageManager(fileName: "appleID")
@State var signedIn:Bool = false
@EnvironmentObject var data:DataModels
@State var tabSelect:tabViews = tabViews.explore
@State var userDB = User()
@State var verifyCredentials = false
@State var navigationTitle:String = "Green Recipe"
@State var showLoading = true
var body: some View {
if(self.signedIn){
// NavigationView{
TabView(selection: $tabSelect) {
NavigationView{
Explore(signedin: $signedIn).environmentObject(data)
}.tabItem { HStack{
Image(systemName: "sparkles")
Text("Explore")
} }.tag(tabViews.explore)
NavigationView{
SearchView(signedin: $signedIn).environmentObject(self.data)
}
.tabItem { HStack{
Image(systemName: "magnifyingglass")
Text("Search")} }.tag(tabViews.search)
NavigationView{
FavoritesView(navigationTitle: self.$navigationTitle, signedin: $signedIn).environmentObject(self.data)
}
.tabItem { HStack{
Image(systemName: "star.fill")
Text("Favorites")} }.tag(tabViews.favorites)
NavigationView{
MyRecipes(navigationTitle: self.$navigationTitle, signedin: $signedIn).environmentObject(data)
}
.tabItem {
HStack{
Image(systemName: "tray.fill")
Text("My Recipes")} }.tag(tabViews.addRecipe)
NavigationView{
Settings(signedin: $signedIn).environmentObject(self.data)
}
.tabItem { HStack{
Image(systemName: "gear")
Text("Settings")} }.tag(tabViews.settings)
}
// .navigationTitle(self.navigationTitle)
// .navigationBarHidden(true)
// }
}
else{
VStack{
Text("Our Recipe")
.fontWeight(.light)
.font(.custom("Heading", size: 40))
.shadow(radius: 10)
Image("iconimg")
.resizable()
.aspectRatio(contentMode: .fit)
.padding()
.shadow(radius: 15)
if showLoading{
activityIndicator()
}
SignInWithAppleButton(.signIn, onRequest: { request in
request.requestedScopes = [.fullName,.email]
// request.nonce = "noncestr"
// request.state = "statestr"
},
onCompletion: { result in
switch(result){
case .success(let authResults):
if let details = authResults.credential as? ASAuthorizationAppleIDCredential{
let userid = details.user
let email = details.email
let identityToken = details.identityToken
let authcode = details.authorizationCode
let givenName = details.fullName?.givenName
let familyName = details.fullName?.familyName
let state = details.state
/*
Find the user in the database, if not found create a new user and add to the database.
if found, retrive their information.
*/
// send a user object to the backend server
var appleID_clean = String(userid)
appleID_clean.removeAll { (c:Character) -> Bool in
if (c == "."){
return true
}
return false
}
self.data.user.appleId = appleID_clean
self.data.user.email = email ?? ""
self.data.user.firstName = givenName ?? ""
self.data.user.lastName = familyName ?? ""
//default username
self.data.user.username = (givenName ?? "" )+" "+(familyName ?? "")
self.userDB.appleId = appleID_clean
//check if user already existed.
print("userid",userid,"email",email,"identityToken",identityToken,"authcode",authcode?.base64EncodedString(),"name",details.fullName?.description,"givenName",givenName,"familyName",familyName,"state",state)
//Find if the user exists
print("Userid",userid.description)
localStorageManager.save("appleID", data: appleID_clean)
self.data.networkHandler.getUserWithAppleID(appleID: appleID_clean, completion: updateUser)
}
case .failure(let error):
print("Failed",error)
self.signedIn = false
}
}
).padding()
.frame(height:100)
.signInWithAppleButtonStyle(.whiteOutline)
Button(action:{self.signedIn = true})
{
Text("Continue")
.font(.title)
.fontWeight(.light)
}
}
.onAppear(){
// self.data.networkHandler.getUserWithAppleID(appleID: "001667ef225cca7d6b459480d20a48ad29ffaf0313", completion: updateUser)
let appleID:String? = localStorageManager.load("appleID")
if appleID != nil{
self.data.networkHandler.getUserWithAppleID(appleID: appleID!, completion: updateUser)
}
else{
showLoading = false
}
}
}
// .sheet(isPresented: self.$verifyCredentials, content: {
// VerifyCredentials(showSheet: self.$verifyCredentials, editUsername: true, user: self.$userDB).environmentObject(self.data)
// })
}
func updateUser(user:User){
self.userDB = user
if self.userDB.firstName == ""{
//new user. Create database entry from the apple credentials.
//verify credentials
// self.verifyCredentials = true
//submit to database
self.data.networkHandler.createUser(user: self.data.user, completion: createUser)
}
else{
self.data.user = self.userDB
self.signedIn = true
}
//fetch favorites and my recipes
self.data.updateCache()
}
func createUser(user:User?, err:Error?){
if err != nil{
print("Error creating user: \(err)")
return
}
if user != nil{
// self.userDB.copyFrom(user: user!)
self.userDB = user!
self.data.user = self.userDB
}
signedIn = true
}
}
struct HomePage_Previews: PreviewProvider {
static var previews: some View {
HomePage().environmentObject(DataModels())
}
}
| 34.146018 | 226 | 0.510691 |
453ad9cafd5eeb8e4c0df7161018381c5928c004 | 1,370 | swift | Swift | assignment/assignment20200427_2/dismissViewcotroller/AViewController.swift | danbin920404/TIL | 13ac97f6478814a7c1221e2870716cd4762a8199 | [
"MIT"
] | 1 | 2020-04-17T01:19:11.000Z | 2020-04-17T01:19:11.000Z | assignment/assignment20200427_2/dismissViewcotroller/AViewController.swift | danbin920404/TIL | 13ac97f6478814a7c1221e2870716cd4762a8199 | [
"MIT"
] | null | null | null | assignment/assignment20200427_2/dismissViewcotroller/AViewController.swift | danbin920404/TIL | 13ac97f6478814a7c1221e2870716cd4762a8199 | [
"MIT"
] | null | null | null | //
// AViewController.swift
// dismissViewcotroller
//
// Created by 성단빈 on 2020/04/27.
// Copyright © 2020 seong. All rights reserved.
//
import UIKit
class AViewController: UIViewController {
let viewComebackBtn: UIButton = UIButton()
let bViewBtn: UIButton = UIButton()
override func viewDidLoad() {
super.viewDidLoad()
viewComebackBtnFn()
bViewBtnFn()
}
private func viewComebackBtnFn() {
viewComebackBtn.setTitle("Home", for: .normal)
viewComebackBtn.sizeToFit()
viewComebackBtn.center = CGPoint(x: view.center.x - 50, y: view.center.y)
viewComebackBtn.addTarget(self, action: #selector(viewComebackTapBtn), for: .touchUpInside)
view.addSubview(viewComebackBtn)
}
private func bViewBtnFn() {
bViewBtn.setTitle("B", for: .normal)
bViewBtn.sizeToFit()
bViewBtn.center = CGPoint(x: view.center.x + 50, y: view.center.y)
bViewBtn.addTarget(self, action: #selector(bViewTapBtn), for: .touchUpInside)
view.addSubview(bViewBtn)
}
@objc private func viewComebackTapBtn(_ sender: UIButton) {
dismiss(animated: true)
}
@objc private func bViewTapBtn(_ sender: UIButton) {
let bView = BViewController()
bView.view.backgroundColor = #colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1)
present(bView, animated: true)
}
}
| 26.862745 | 116 | 0.69708 |
b2c4382563bdc135f87a0336d22aa149de5f9c44 | 9,203 | py | Python | rollon_erpnext/hooks_property_setter.py | santoshbb/rhplrepo | 8ce4792ea47b66ab2b7aed9da468104a2d37ae2b | [
"MIT"
] | null | null | null | rollon_erpnext/hooks_property_setter.py | santoshbb/rhplrepo | 8ce4792ea47b66ab2b7aed9da468104a2d37ae2b | [
"MIT"
] | null | null | null | rollon_erpnext/hooks_property_setter.py | santoshbb/rhplrepo | 8ce4792ea47b66ab2b7aed9da468104a2d37ae2b | [
"MIT"
] | null | null | null | property_setter = {
"dt": "Property Setter",
"filters": [
["name", "in", [
'Purchase Order-read_only_onload',
'Purchase Order-default_print_format',
'Purchase Invoice-naming_series-options',
'Purchase Invoice-naming_series-default',
'Delivery Note-naming_series-options',
'Delivery Note-naming_series-default',
'Sales Order-naming_series-options',
'Sales Order-naming_series-default',
'Purchase Receipt-naming_series-options',
'Purchase Receipt-naming_series-default',
'Production Order-naming_series-options',
'Production Order-naming_series-default',
'Stock Entry-naming_series-options',
'Stock Entry-naming_series-default',
'Purchase Order-naming_series-options',
'Purchase Order-naming_series-default',
'Sales Invoice-naming_series-options',
'Sales Invoice-naming_series-default',
'Purchase Invoice-read_only_onload',
'Stock Reconciliation-read_only_onload',
'Delivery Note-read_only_onload',
'Stock Entry-read_only_onload',
'Sales Invoice-po_no-read_only',
'Sales Invoice-read_only_onload',
'Purchase Receipt Item-read_only_onload',
'Custom Field-fieldname-width',
'Custom Field-dt-width',
'Sales Invoice Item-read_only_onload',
'Sales Invoice Item-warehouse-default',
'Sales Order-po_no-read_only',
'Sales Order-read_only_onload',
'Item-read_only_onload',
'User-read_only_onload',
'User-sort_field',
'Asset Maintenance Task-periodicity-options',
'Asset Maintenance Task-read_only_onload',
'Asset-read_only_onload',
'Sales Invoice Item-customer_item_code-print_hide',
'Sales Invoice Item-customer_item_code-hidden',
'Sales Order Item-read_only_onload',
'BOM-with_operations-default',
'BOM-read_only_onload',
'Stock Entry-default_print_format',
'Purchase Receipt-read_only_onload',
'Production Order-skip_transfer-default',
'Production Order-skip_transfer-read_only',
'Production Order-use_multi_level_bom-default',
'Production Order-use_multi_level_bom-read_only',
'Production Order-read_only_onload',
'Purchase Order Item-amount-precision',
'Purchase Order Item-read_only_onload',
'Purchase Order Item-rate-precision',
'Stock Entry-use_multi_level_bom-default',
'Stock Entry-use_multi_level_bom-read_only',
'Stock Entry-from_bom-read_only',
'Stock Entry-from_bom-default',
'Stock Entry Detail-barcode-read_only',
'Stock Entry Detail-read_only_onload',
'Stock Entry-to_warehouse-read_only',
'Stock Entry-from_warehouse-read_only',
'Stock Entry-remarks-reqd',
'Purchase Receipt-in_words-print_hide',
'Purchase Receipt-in_words-hidden',
'Purchase Invoice-in_words-print_hide',
'Purchase Invoice-in_words-hidden',
'Purchase Order-in_words-print_hide',
'Purchase Order-in_words-hidden',
'Supplier Quotation-in_words-print_hide',
'Supplier Quotation-in_words-hidden',
'Delivery Note-in_words-print_hide',
'Delivery Note-in_words-hidden',
'Sales Invoice-in_words-print_hide',
'Sales Invoice-in_words-hidden',
'Sales Order-in_words-print_hide',
'Sales Order-in_words-hidden',
'Quotation-in_words-print_hide',
'Quotation-in_words-hidden',
'Purchase Order-rounded_total-print_hide',
'Purchase Order-rounded_total-hidden',
'Purchase Order-base_rounded_total-print_hide',
'Purchase Order-base_rounded_total-hidden',
'Supplier Quotation-rounded_total-print_hide',
'Supplier Quotation-rounded_total-hidden',
'Supplier Quotation-base_rounded_total-print_hide',
'Supplier Quotation-base_rounded_total-hidden',
'Delivery Note-rounded_total-print_hide',
'Delivery Note-rounded_total-hidden',
'Delivery Note-base_rounded_total-print_hide',
'Delivery Note-base_rounded_total-hidden',
'Sales Invoice-rounded_total-print_hide',
'Sales Invoice-rounded_total-hidden',
'Sales Invoice-base_rounded_total-print_hide',
'Sales Invoice-base_rounded_total-hidden',
'Sales Order-rounded_total-print_hide',
'Sales Order-rounded_total-hidden',
'Sales Order-base_rounded_total-print_hide',
'Sales Order-base_rounded_total-hidden',
'Quotation-rounded_total-print_hide',
'Quotation-rounded_total-hidden',
'Quotation-base_rounded_total-print_hide',
'Quotation-base_rounded_total-hidden',
'Dropbox Settings-dropbox_setup_via_site_config-hidden',
'Dropbox Settings-read_only_onload',
'Dropbox Settings-dropbox_access_token-hidden',
'Activity Log-subject-width',
'Employee-employee_number-hidden',
'Employee-employee_number-reqd',
'Employee-naming_series-reqd',
'Employee-naming_series-hidden',
'Supplier-naming_series-hidden',
'Supplier-naming_series-reqd',
'Delivery Note-tax_id-print_hide',
'Delivery Note-tax_id-hidden',
'Sales Invoice-tax_id-print_hide',
'Sales Invoice-tax_id-hidden',
'Sales Order-tax_id-print_hide',
'Sales Order-tax_id-hidden',
'Customer-naming_series-hidden',
'Customer-naming_series-reqd',
'Stock Entry Detail-barcode-hidden',
'Stock Reconciliation Item-barcode-hidden',
'Item-barcode-hidden',
'Delivery Note Item-barcode-hidden',
'Sales Invoice Item-barcode-hidden',
'Purchase Receipt Item-barcode-hidden',
'Item-item_code-reqd',
'Item-item_code-hidden',
'Item-naming_series-hidden',
'Item-naming_series-reqd',
'Item-manufacturing-collapsible_depends_on',
'Purchase Invoice-payment_schedule-print_hide',
'Purchase Invoice-due_date-print_hide',
'Purchase Order-payment_schedule-print_hide',
'Purchase Order-due_date-print_hide',
'Sales Invoice-payment_schedule-print_hide',
'Sales Invoice-due_date-print_hide',
'Sales Order-payment_schedule-print_hide',
'Sales Order-due_date-print_hide',
'Journal Entry Account-sort_order',
'Journal Entry Account-account_currency-print_hide',
'Sales Invoice-taxes_and_charges-reqd',
'Sales Taxes and Charges-sort_order',
'Sales Invoice Item-customer_item_code-label',
'Sales Invoice-default_print_format',
'Purchase Taxes and Charges Template-sort_order',
'Serial No-company-in_standard_filter',
'Serial No-amc_expiry_date-in_standard_filter',
'Serial No-warranty_expiry_date-in_standard_filter',
'Serial No-maintenance_status-in_standard_filter',
'Serial No-customer_name-in_standard_filter',
'Serial No-customer_name-bold',
'Serial No-customer-in_standard_filter',
'Serial No-delivery_document_no-in_standard_filter',
'Serial No-delivery_document_type-in_standard_filter',
'Serial No-supplier_name-bold',
'Serial No-supplier_name-in_standard_filter',
'Serial No-supplier-in_standard_filter',
'Serial No-purchase_date-in_standard_filter',
'Serial No-description-in_standard_filter',
'Delivery Note-section_break1-hidden',
'Delivery Note-sales_team_section_break-hidden',
'Delivery Note-project-hidden',
'Delivery Note-taxes-hidden',
'Delivery Note-taxes_and_charges-hidden',
'Delivery Note-taxes_section-hidden',
'Delivery Note-posting_time-print_hide',
'Delivery Note-posting_time-description',
'Delivery Note Item-warehouse-default',
'Item-income_account-default',
'Item-income_account-depends_on',
'Purchase Receipt-remarks-reqd',
'Purchase Receipt-taxes-hidden',
'Purchase Receipt-taxes_and_charges-hidden',
'Purchase Receipt Item-base_rate-fieldtype',
'Purchase Receipt Item-amount-in_list_view',
'Purchase Receipt Item-rate-fieldtype',
'Purchase Receipt Item-base_price_list_rate-fieldtype',
'Purchase Receipt Item-price_list_rate-fieldtype',
'Purchase Receipt Item-qty-in_list_view',
'Stock Entry-title_field',
'Stock Entry-search_fields',
'Stock Entry-project-hidden',
'Stock Entry-supplier-in_list_view',
'Stock Entry-from_warehouse-in_list_view',
'Stock Entry-to_warehouse-in_list_view',
'Stock Entry-purpose-default',
'ToDo-sort_order',
'Currency Exchange-sort_order',
'Company-abbr-in_list_view',
'Stock Reconciliation-expense_account-in_standard_filter',
'Stock Reconciliation-expense_account-depends_on',
'Sales Order-taxes-hidden',
'Warehouse-sort_order',
'Address-fax-hidden',
'Address-fax-read_only',
'Address-phone-hidden',
'Address-email_id-hidden',
'Address-city-reqd',
'BOM Operation-sort_order',
'BOM Item-scrap-read_only',
'BOM-operations_section-read_only',
'BOM-operations-read_only',
'BOM-rm_cost_as_per-reqd',
'Journal Entry-pay_to_recd_from-allow_on_submit',
'Journal Entry-remark-in_global_search',
'Journal Entry-total_amount-bold',
'Journal Entry-total_amount-print_hide',
'Journal Entry-total_amount-in_list_view',
'Journal Entry-total_credit-print_hide',
'Journal Entry-total_debit-print_hide',
'Journal Entry-total_debit-in_list_view',
'Journal Entry-user_remark-print_hide',
'Stock Entry-to_warehouse-hidden',
'Purchase Order Item-rate-fieldtype',
'Journal Entry Account-exchange_rate-print_hide',
'Sales Invoice Item-item_code-label',
'BOM-rm_cost_as_per-options',
'Purchase Order Item-price_list_rate-fieldtype',
'Reconciliation-expense_account-read_only',
'Customer-tax_id-read_only',
'Purchase Order Item-amount-fieldtype',
'Stock Entry-project-hidden'
]
]
]
} | 40.013043 | 61 | 0.757688 |
761b4446556787229342b806544c5c07db056df1 | 355 | go | Go | clase1/holamundo.go | chetinchog/pp-go | b0a230110fd602bc74f961d87e106212da0a675d | [
"MIT"
] | null | null | null | clase1/holamundo.go | chetinchog/pp-go | b0a230110fd602bc74f961d87e106212da0a675d | [
"MIT"
] | null | null | null | clase1/holamundo.go | chetinchog/pp-go | b0a230110fd602bc74f961d87e106212da0a675d | [
"MIT"
] | null | null | null | package main
import (
"fmt"
)
func sumar(a, b int) int {
return a + b
}
func main() {
fmt.Println("Hola mundo!")
s := sumar
r := s(10, 5)
fmt.Println(r)
// var a int = 10
// b := 20
const c = "hola"
fmt.Println()
for i := 0; i < 3; i++ {
fmt.Printf("Hola %d\n", i)
}
fmt.Println()
if m := 2 % 2; m == 0 {
fmt.Println("Par")
}
}
| 10.757576 | 28 | 0.507042 |
7411c8e1f3cff88118652bdfac0aa36e3037109c | 878 | kt | Kotlin | app/src/main/java/au/com/mealplanner/mealplanner/feature/viewMeals/ViewMealsActivity.kt | jleu1656/meal-planner | 114eceb65b5efbed4e985b1f7c0d1d675fd16bc2 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/au/com/mealplanner/mealplanner/feature/viewMeals/ViewMealsActivity.kt | jleu1656/meal-planner | 114eceb65b5efbed4e985b1f7c0d1d675fd16bc2 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/au/com/mealplanner/mealplanner/feature/viewMeals/ViewMealsActivity.kt | jleu1656/meal-planner | 114eceb65b5efbed4e985b1f7c0d1d675fd16bc2 | [
"Apache-2.0"
] | null | null | null | package au.com.mealplanner.mealplanner.feature.viewMeals
import android.os.Bundle
import au.com.mealplanner.mealplanner.R
import au.com.mealplanner.mealplanner.base.BaseActivity
import au.com.mealplanner.mealplanner.data.model.Meal
import dagger.android.AndroidInjection
import javax.inject.Inject
class ViewMealsActivity : BaseActivity(), ViewMealView {
override fun showError() {
}
override fun showMealList(mealList: List<Meal>) {
}
@Inject
lateinit var activityPresenter: ViewMealsActivityPresenter
override fun getLayoutId(): Int {
return R.layout.view_meal_activity
}
override fun inject() {
AndroidInjection.inject(this)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
activityPresenter.setView(this)
activityPresenter.getMeals()
}
} | 25.823529 | 62 | 0.73918 |
a1c53cdb4d4d5a017d0bfdca87b00517745d7b78 | 149 | c | C | C01/ex06/main6.c | tahaerel/42-Ecole | bce9398f88eb286d4386eae108983a9ec7851102 | [
"MIT"
] | null | null | null | C01/ex06/main6.c | tahaerel/42-Ecole | bce9398f88eb286d4386eae108983a9ec7851102 | [
"MIT"
] | null | null | null | C01/ex06/main6.c | tahaerel/42-Ecole | bce9398f88eb286d4386eae108983a9ec7851102 | [
"MIT"
] | null | null | null | #include <stdio.h>
int ft_strlen(char *str);
int main (void)
{
char str[] = "Amanda";
int count = ft_strlen(str);
printf("%d\n", count);
}
| 12.416667 | 28 | 0.597315 |
5ae3217702eb9b95c06da775dced00d6be9ed4b3 | 1,609 | rs | Rust | vobsub/tests/parse_corpus.rs | sykul/subtitles-rs | f8a8b824070c1f397c4c22e4da7738562c147585 | [
"CC0-1.0"
] | 195 | 2017-03-08T21:55:21.000Z | 2022-03-10T00:47:05.000Z | vobsub/tests/parse_corpus.rs | emk/substudy | f8a8b824070c1f397c4c22e4da7738562c147585 | [
"CC0-1.0"
] | 34 | 2015-12-12T02:28:50.000Z | 2017-12-23T15:55:16.000Z | vobsub/tests/parse_corpus.rs | sykul/subtitles-rs | f8a8b824070c1f397c4c22e4da7738562c147585 | [
"CC0-1.0"
] | 23 | 2017-05-06T08:33:15.000Z | 2021-12-11T17:11:35.000Z | extern crate env_logger;
extern crate glob;
#[macro_use]
extern crate log;
extern crate vobsub;
use std::fs;
use std::io::prelude::*;
use std::path::Path;
// To run this test, use `cargo test -- --ignored`. This tests against a
// larger selection of *.sub files in our private corpus, which is
// unfortunately not open source.
#[test]
#[ignore]
fn private_corpus() {
let _ = env_logger::init();
let options = glob::MatchOptions {
case_sensitive: true,
require_literal_separator: true,
require_literal_leading_dot: true,
};
for entry in glob::glob_with("../private/**/*.sub", &options).unwrap() {
let entry = entry.unwrap();
process_file(&entry, false);
}
}
// This corpus was generated using `cargo fuzz`, and it represents all the
// crashes that we've found so far.
#[test]
fn error_corpus() {
let _ = env_logger::init();
let options = glob::MatchOptions {
case_sensitive: true,
require_literal_separator: true,
require_literal_leading_dot: true,
};
for entry in glob::glob_with("../fixtures/invalid/*", &options).unwrap() {
let entry = entry.unwrap();
process_file(&entry, true);
}
}
fn process_file(path: &Path, expect_err: bool) {
debug!("Processing {}", path.display());
let mut f = fs::File::open(path).unwrap();
let mut buffer = vec![];
f.read_to_end(&mut buffer).unwrap();
let count = vobsub::subtitles(&buffer)
.map(|s| {
assert_eq!(s.is_err(), expect_err);
})
.count();
debug!("Found {} subtitles", count);
}
| 27.271186 | 78 | 0.624612 |
856e0d0f7e398843340d1e03e9802dca153fae9b | 6,410 | js | JavaScript | public/assets/js/custom_validation.js | RushiShirkar/moonfood-api | dfbfb6c6086984f84077dca7f807bc8386521991 | [
"MIT"
] | null | null | null | public/assets/js/custom_validation.js | RushiShirkar/moonfood-api | dfbfb6c6086984f84077dca7f807bc8386521991 | [
"MIT"
] | null | null | null | public/assets/js/custom_validation.js | RushiShirkar/moonfood-api | dfbfb6c6086984f84077dca7f807bc8386521991 | [
"MIT"
] | null | null | null | function isNumber(e){return!!e.match(/^[0-9]+$/)}function isChar(e){return!!e.match(/^[a-zA-Z]+$/)}function isEmpty(e){return""==e||null==e}function isEmail(e){return!!/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e)}function error(e,r,t){$("#"+e).css({border:"1px solid red"}),$("#"+r).html(t)}function success(e,r,t){$("#"+e).css({border:"1px solid green"}),$("#"+r).html(t)}function isUrl(e){return!!/^(?:(ftp|http|https)?:\/\/)?(?:[\w-]+\.)+([a-z]|[A-Z]|[0-9]){2,6}$/.test(e)}function isSpecialPassword(e){return!!/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/.test(e)}function length(e,r,t){var o=e.length;return o>=r&&o<=t}function show_loading(){$(".loading").show()}function login(e,r){localStorage.setItem("token",r.result.token),localStorage.setItem("local_id",r.result.local_id),window.location.href="/"}function register1(e,r){window.location.href="/api/auth/completeRegister?mobile="+r.email+"&code=1"}function otpverify(e,r){window.location.href="/"}function createpassword(e,r){window.location.href="/success"}function forgetpassword(e,r){window.location.href="/api/auth/completeForgetpassword?mobile="+r.email}function reset_password(e,r){window.location.href="/api/auth/login?msg=successfully reset password, please login to continue your service"}function Global_ajaxCall(e,r,t,o,a){$.ajax({type:r,url:e,dataType:"json",data:o,success:function(e){"login"==a?login(t,e):"register"==a?register1(t,e):"otpverify"==a?otpverify(t,e):"createpassword"==a?createpassword(t,e):"forgetpassword"==a?forgetpassword(t,e):"reset_password"==a&&reset_password(t,e)},error:function(e,r,a){return 500==e.status?($(".loading").hide(),a=(a=$.parseJSON(e.responseText)).message,$("#"+t).show().html(a),"please activate your account before login"==a&&(window.location.href="/api/auth/completeRegister?mobile="+o.mobile),"otp already send to your mobile"==a&&(window.location.href="/api/auth/completeForgetpassword?mobile="+o.mobile),!1):(alert("System error found refresh page"),!1)}})}$(document).ready(function(){$(document).on("click",".show_password",function(){"password"==$("#"+$(this).attr("data-btn")).attr("type")?($("#"+$(this).attr("data-btn")).attr("type","text"),$(this).html("hide")):($("#"+$(this).attr("data-btn")).attr("type","password"),$(this).html("show"))}),$(document).on("submit","#reset_password_form",function(e){var r=$("#OTP_txt").val(),t=$("#mobile_txt").attr("data-value"),o=$("#createpassword_pwd1").val(),a=$("#createpassword_pwd2").val();if(isEmpty(r)||isEmpty(o)||isEmpty(a))return e.preventDefault(),$("#error").show().html("OTP required"),!1;if(!length(r,6,6))return e.preventDefault(),$("#error").show().html("Invalid OTP found"),!1;if(!isNumber(r))return e.preventDefault(),$("#error").show().html("Invalid OTP found"),!1;if(o.length<=6)return e.preventDefault(),$("#error").show().html("Invalid mobile number or password found"),!1;if(o!=a)return e.preventDefault(),$("#error").show().html("Password not match"),!1;$("#error").hide();return Global_ajaxCall("/api/auth/completeForgetpassword","POST","error",{mobile:t,code:r,password:o},"reset_password"),show_loading(),e.preventDefault(),!0}),$(document).on("submit","#login_form",function(e){var r=$("#mobile_txt").val(),t=$("#pwd1").val();if(isEmpty(r))return e.preventDefault(),$("#error").show().html("Mobile number required"),!1;if(isEmpty(t))return e.preventDefault(),$("#error").show().html("password required"),!1;if(!isNumber(r)||!length(r,10,10))return e.preventDefault(),$("#error").show().html("Invalid mobile number found"),!1;if(t.length<=6)return e.preventDefault(),$("#error").show().html("Invalid mobile number or password found"),!1;$("#error").hide(),show_loading();return Global_ajaxCall("/api/auth/login","POST","error",{mobile:r,password:t},"login"),e.preventDefault(),!0}),$(document).on("submit","#register_form",function(e){var r=$("#mobile_txt").val(),t=$("#createpassword_pwd1").val(),o=$("#createpassword_pwd2").val();if(isEmpty(r))return e.preventDefault(),$("#error").show().html("mobile number required"),!1;if(!length(r,10,10))return e.preventDefault(),$("#error").show().html("Invalid Mobile number found"),!1;if(!isNumber(r))return e.preventDefault(),$("#error").show().html("Invalid Mobile number found"),!1;if(t.length<=6)return e.preventDefault(),$("#error").show().html("password at least 6 characters"),!1;if(t!=o)return e.preventDefault(),$("#error").show().html("password not match"),!1;$("#error").hide();return Global_ajaxCall("/api/auth/register","POST","error",{mobile:r,password:t},"register"),show_loading(),e.preventDefault(),!0}),$(document).on("submit","#otpverify_form",function(e){var r=$("#OTP_txt").val();if(isEmpty(r))return e.preventDefault(),$("#error").show().html("OTP required"),!1;if(!length(r,6,6))return e.preventDefault(),$("#error").show().html("Invalid OTP found"),!1;if(!isNumber(r))return e.preventDefault(),$("#error").show().html("Invalid OTP found"),!1;$("#error").hide(),$("#mobile_txt").html();return Global_ajaxCall("/api/auth/completeRegister","POST","error",{mobile:$("#mobile_txt").html(),code:r},"otpverify"),show_loading(),e.preventDefault(),!0}),$(document).on("submit","#forgetpassword_form",function(e){var r=$("#mobile_txt").val();if(!isEmpty(r)){if(isNumber(r)){if(length(r,10,10)){$("#error").hide(),show_loading();return Global_ajaxCall("/api/auth/forgetpassword","POST","error",{mobile:r},"forgetpassword"),e.preventDefault(),!0}return e.preventDefault(),$("#error").show().html("Invalid mobile number found"),!1}return e.preventDefault(),$("#error").show().html("Only numeric value required"),!1}return e.preventDefault(),$("#error").show().html("Mobile number required"),!1}),$(document).on("submit","#createpassword_form",function(e){var r=$("#createpassword_pwd1").val(),t=$("#createpassword_pwd2").val();if(isEmpty(r)||isEmpty(t))return e.preventDefault(),$("#error").show().html("Password required"),!1;if(!length(r,8,32))return e.preventDefault(),$("#error").show().html("Password must be more than 8 characters"),!1;if(r!=t)return e.preventDefault(),$("#error").show().html("Password not match"),!1;$("#error").hide();var o={email:$("#mobile_txt").attr("data-value"),password:r};return $.ajaxSetup({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")}}),Global_ajaxCall("/api/auth/create_password","POST","error",o,"createpassword"),show_loading(),e.preventDefault(),!0})}); | 6,410 | 6,410 | 0.679095 |
6a1e7fc56ceae5d9a741fb442e8ac30d57d6f102 | 384 | sql | SQL | Atividades ate 26-07-2019/Querys/FirstTable.sql | DanielaLischeski/GitDani | 84faf2428233b6a5f54f3d7e3428fc5df3b59137 | [
"MIT"
] | null | null | null | Atividades ate 26-07-2019/Querys/FirstTable.sql | DanielaLischeski/GitDani | 84faf2428233b6a5f54f3d7e3428fc5df3b59137 | [
"MIT"
] | null | null | null | Atividades ate 26-07-2019/Querys/FirstTable.sql | DanielaLischeski/GitDani | 84faf2428233b6a5f54f3d7e3428fc5df3b59137 | [
"MIT"
] | null | null | null | insert into AulaCsharp
(Aluno,Idade,Ativo,UsuInc,UsuAlt,DatInc,DatAlt)
values
('Daniela',35,1,22031984,20051985,GETDATE(),GETDATE()),
('Gilberto',34,1,22031984,20051985,GETDATE(),GETDATE()),
('Vanessa',33,1,22031984,10071986,GETDATE(),GETDATE()),
('Andrei',24,0,22031984,17071995,GETDATE(),GETDATE()),
('David',24,0,22031984,26051995,GETDATE(),GETDATE());
go
select * from AulaCsharp | 38.4 | 56 | 0.742188 |
91632b77f73091178262772f8bee022c64eaa05c | 4,568 | swift | Swift | DynamicWebKit/DynamicWebKit/WebViewController.swift | kharrison/CodeExamples | a0a0d2951ef3348857851d84a46dead5fd543245 | [
"BSD-3-Clause"
] | 1,739 | 2015-01-06T17:26:13.000Z | 2022-03-29T23:18:38.000Z | DynamicWebKit/DynamicWebKit/WebViewController.swift | kharrison/CodeExamples | a0a0d2951ef3348857851d84a46dead5fd543245 | [
"BSD-3-Clause"
] | 11 | 2015-03-10T20:58:00.000Z | 2020-07-22T20:42:10.000Z | DynamicWebKit/DynamicWebKit/WebViewController.swift | kharrison/CodeExamples | a0a0d2951ef3348857851d84a46dead5fd543245 | [
"BSD-3-Clause"
] | 951 | 2015-01-03T21:11:19.000Z | 2022-03-23T09:28:56.000Z | // Created by Keith Harrison https://useyourloaf.com
// Copyright (c) 2017-2020 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
import UIKit
import WebKit
final class WebViewController: UIViewController {
@IBOutlet private var backwardButton: UIBarButtonItem!
@IBOutlet private var forwardButton: UIBarButtonItem!
var html: String = "default" {
didSet {
loadHTML(html)
}
}
private lazy var webView: WKWebView = {
let configuration = WKWebViewConfiguration()
if #available(iOS 14.0, *) {
// Allow restricted API access on the
// app-bound domains (cookies, etc).
// Doesn't seem to be required
// configuration.limitsNavigationsToAppBoundDomains = true
} else {
// Fallback to WKPreferences for iOS 13 to
// disable javascript.
let preferences = WKPreferences()
// preferences.javaScriptEnabled = false
configuration.preferences = preferences
}
let webView = WKWebView(frame: .zero, configuration: configuration)
webView.navigationDelegate = self
return webView
}()
override func loadView() {
view = webView
loadHTML(html)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
}
@IBAction func forwardAction(_ sender: UIBarButtonItem) {
webView.goForward()
}
@IBAction func backwardAction(_ sender: UIBarButtonItem) {
webView.goBack()
}
@objc private func contentSizeDidChange(_ notification: Notification) {
webView.reload()
}
private func loadHTML(_ name: String) {
if let url = Bundle.main.url(forResource: name, withExtension: "html") {
webView.loadFileURL(url, allowingReadAccessTo: url)
}
}
}
extension WebViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) {
if #available(iOS 14.0, *) {
// To disable all javascript content
// preferences.allowsContentJavaScript = true
}
decisionHandler(.allow, preferences)
}
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
print(error)
updateNavigationState(webView)
}
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
updateNavigationState(webView)
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
updateNavigationState(webView)
}
private func updateNavigationState(_ webView: WKWebView) {
backwardButton.isEnabled = webView.canGoBack
forwardButton.isEnabled = webView.canGoForward
}
}
| 39.37931 | 214 | 0.702058 |
a199d1a03962d357e534607c55467841eb800347 | 1,579 | h | C | Tools/ecg-kit-master/common/eplimited/src/inputs.h | giovanni-bort/CINC20-Bort.Ivo | 554ee0ddf445a5edffa9b0df8600b627fa882832 | [
"BSD-2-Clause"
] | 2 | 2021-04-24T09:52:25.000Z | 2022-03-03T13:15:17.000Z | Tools/ecg-kit-master/common/eplimited/src/inputs.h | giovanni-bort/CINC20-Bort.Ivo | 554ee0ddf445a5edffa9b0df8600b627fa882832 | [
"BSD-2-Clause"
] | null | null | null | Tools/ecg-kit-master/common/eplimited/src/inputs.h | giovanni-bort/CINC20-Bort.Ivo | 554ee0ddf445a5edffa9b0df8600b627fa882832 | [
"BSD-2-Clause"
] | null | null | null | /* file: inputs.h
This file defines the set of records that 'easytest' processes and that
'bxbep' uses for deriving performance statistics.
*/
// Uncomment only one of the next three lines.
#define PHYSIOBANK // 25 freely available MIT-BIH records from PhysioBank
// #define MITDB // 48 MIT-BIH records in 'mitdb'
// #define AHADB // 69 AHA records in 'ahadb'
// If using MITDB or AHADB, edit the definition of ECG_DB_PATH to include
// the location where you have installed the database files. Do not remove
// the initial "." or the space following it in the definition of ECG_DB_PATH!
#ifdef PHYSIOBANK
#define ECG_DB_PATH ". http://www.physionet.org/physiobank/database/mitdb"
int Records[] = {100,101,102,103,104,105,106,107,118,119,
200,201,202,203,205,207,208,209,210,212,213,214,215,217,219};
#endif
#ifdef MITDB
#define ECG_DB_PATH ". mitdb"
int Records[] = {100,101,102,103,104,105,106,107,108,109,111,112,
113,114,115,116,117,118,119,121,122,123,124,200,
201,202,203,205,207,208,209,210,212,213,214,215,
217,219,220,221,222,223,228,230,231,232,233,234};
#endif
#ifdef AHADB
#define ECG_DB_PATH ". ahadb"
int Records[] = {1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,
2201,2203,2204,2205,2206,2207,2208,2209,2210,
3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,
4201,4202,4203,4204,4205,4206,4207,4208,4209,4210,
5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,
6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,
7201,7202,7203,7204,7205,7206,7207,7208,7209,7210};
#endif
#define REC_COUNT (sizeof(Records)/sizeof(int))
| 36.72093 | 78 | 0.734009 |
7104a23237f0328a2df3a7d9c5ec0e5207e663aa | 1,006 | ts | TypeScript | frontend/src/app/pages/settings/users/user-details/mutate-user/mutate-user.component.ts | jsc-masshtab/vdi-server | 3de49dec986ab26ffc6c073873fb9de5943809f9 | [
"MIT"
] | 2 | 2021-12-03T10:04:25.000Z | 2022-01-12T06:26:39.000Z | frontend/src/app/pages/settings/users/user-details/mutate-user/mutate-user.component.ts | jsc-masshtab/vdi-server | 3de49dec986ab26ffc6c073873fb9de5943809f9 | [
"MIT"
] | null | null | null | frontend/src/app/pages/settings/users/user-details/mutate-user/mutate-user.component.ts | jsc-masshtab/vdi-server | 3de49dec986ab26ffc6c073873fb9de5943809f9 | [
"MIT"
] | null | null | null | import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { WaitService } from '../../../../../core/components/wait/wait.service';
import { UsersService } from '../../users.service';
@Component({
selector: 'mutate-user',
templateUrl: './mutate-user.component.html',
styleUrls: ['./mutate-user.component.scss']
})
export class MutateUserComponent {
constructor(
private waitService: WaitService,
private dialogRef: MatDialogRef<MutateUserComponent>,
@Inject(MAT_DIALOG_DATA) public data,
private service: UsersService) { }
public send() {
this.waitService.setWait(true);
this.service.mutate(this.data.params).subscribe((res) => {
if (res) {
setTimeout(() => {
this.dialogRef.close();
this.service.getUser(this.data.id).refetch();
this.service.getAllUsers().refetch();
this.waitService.setWait(false);
}, 1000);
}
});
}
}
| 29.588235 | 79 | 0.648111 |
4c574b1961df0c8f881832677258e97b6a86ba80 | 811 | kt | Kotlin | src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/controller/ServiceTurboPlanController.kt | Kinway050/bk-ci | 86fa21d345d9c06b3f6857ba38d8d8d0d96ca7e3 | [
"MIT"
] | 1,939 | 2019-05-29T05:15:45.000Z | 2022-03-29T11:49:16.000Z | src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/controller/ServiceTurboPlanController.kt | Kinway050/bk-ci | 86fa21d345d9c06b3f6857ba38d8d8d0d96ca7e3 | [
"MIT"
] | 3,608 | 2019-06-05T07:55:23.000Z | 2022-03-31T15:03:41.000Z | src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/controller/ServiceTurboPlanController.kt | Kinway050/bk-ci | 86fa21d345d9c06b3f6857ba38d8d8d0d96ca7e3 | [
"MIT"
] | 561 | 2019-05-29T07:15:10.000Z | 2022-03-29T09:32:15.000Z | package com.tencent.devops.turbo.controller
import com.tencent.devops.api.pojo.Response
import com.tencent.devops.turbo.api.IServiceTurboPlanController
import com.tencent.devops.turbo.service.TurboPlanService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RestController
@Suppress("MaxLineLength")
@RestController
class ServiceTurboPlanController @Autowired constructor(
private val turboPlanService: TurboPlanService
) : IServiceTurboPlanController {
override fun findTurboPlanIdByProjectIdAndPipelineInfo(projectId: String, pipelineId: String, pipelineElementId: String): Response<String?> {
return Response.success(turboPlanService.findMigratedTurboPlanByPipelineInfo(projectId, pipelineId, pipelineElementId)?.taskId)
}
}
| 42.684211 | 145 | 0.839704 |
27483363ccab2d67a98350a21c94e01ce31d5aa3 | 6,949 | kt | Kotlin | app/src/main/java/com/race/mediocreplan/ui/TaskDetailActivity.kt | alexfanchina/mediocreplan-android | 47bc7ec7d20a3bc865293aa4a4115c367fec2f3d | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/race/mediocreplan/ui/TaskDetailActivity.kt | alexfanchina/mediocreplan-android | 47bc7ec7d20a3bc865293aa4a4115c367fec2f3d | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/race/mediocreplan/ui/TaskDetailActivity.kt | alexfanchina/mediocreplan-android | 47bc7ec7d20a3bc865293aa4a4115c367fec2f3d | [
"Apache-2.0"
] | null | null | null | package com.race.mediocreplan.ui
import android.animation.ObjectAnimator
import android.app.ActivityOptions
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.transition.*
import android.util.Log
import android.view.View
import com.google.gson.Gson
import com.race.mediocreplan.R
import com.race.mediocreplan.data.model.Task
import com.race.mediocreplan.ui.utils.TaskItemUtils
import com.race.mediocreplan.viewModel.TaskViewModel
import kotlinx.android.synthetic.main.activity_task_detail.*
class TaskDetailActivity : AppCompatActivity() {
lateinit var task: Task
lateinit var taskViewModel: TaskViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_task_detail)
taskViewModel = TaskViewModel.create(this, application)
task = intent.getParcelableExtra(EXTRA_TASK)
Log.d(TAG, "get parcelable extra " + task.toString())
background.setOnClickListener { onBackPressed() }
initStyle()
loadData()
}
override fun onBackPressed() {
val transition = AutoTransition()
transition.duration = 200
TransitionManager.beginDelayedTransition(card, transition)
text_narration.visibility = View.GONE
button_start_now.visibility = View.GONE
button_add_to_plan.visibility = View.GONE
supportFinishAfterTransition()
}
private fun initStyle() {
card.setCardBackgroundColor(ColorStateList.valueOf(
getColor(TaskItemUtils.getCardColor(task.cardIdentifier))))
val textColor = getColor(TaskItemUtils.getTextColor(task.cardIdentifier))
val textColorTintList = ColorStateList.valueOf(textColor)
text_title.setTextColor(textColor)
text_narration.setTextColor(textColor)
text_period.setTextColor(textColor)
text_popularity.setTextColor(textColor)
text_contributor.setTextColor(textColor)
text_progress_done.setTextColor(textColor)
text_progress_left.setTextColor(textColor)
text_period.compoundDrawableTintList = textColorTintList
text_popularity.compoundDrawableTintList = textColorTintList
text_contributor.compoundDrawableTintList = textColorTintList
progress.progressBackgroundTintList = textColorTintList
progress.progressTintList = textColorTintList
val buttonColor = getColor(TaskItemUtils.getButtonColor(task.cardIdentifier))
button_start_now.backgroundTintList = ColorStateList.valueOf(buttonColor)
button_add_to_plan.backgroundTintList = ColorStateList.valueOf(buttonColor)
text_narration.visibility = View.GONE
button_start_now.visibility = View.GONE
button_add_to_plan.visibility = View.GONE
window.sharedElementEnterTransition.duration = 200
window.sharedElementEnterTransition.addListener(object : Transition.TransitionListener {
override fun onTransitionEnd(transition: Transition?) {
val t = AutoTransition()
t.duration = 200
TransitionManager.beginDelayedTransition(card, t)
text_narration.visibility = View.VISIBLE
button_start_now.visibility = View.VISIBLE
button_add_to_plan.visibility = View.VISIBLE
}
override fun onTransitionResume(transition: Transition?) {}
override fun onTransitionPause(transition: Transition?) {}
override fun onTransitionCancel(transition: Transition?) {}
override fun onTransitionStart(transition: Transition?) {}
})
}
private fun loadData() {
Log.d(TAG, "load " + Gson().toJson(task))
Log.d(TAG, "${task._id}: startDate=${task.startTime}, timeUsed=${task.getTimeUsed()}, timeExpected=${task.getTimeExpected()}")
text_title.text = task.title
text_narration.text = task.narration
text_period.text = task.duration.toString(this)
text_popularity.text = getString(R.string.desc_popularity, task.popularity)
text_contributor.text = getString(R.string.desc_contributor, task.contributor)
button_start_now.setOnClickListener { v ->
taskViewModel.startTask(task)
loadData()
}
TransitionManager.beginDelayedTransition(card)
when (task.getStatus()) {
Task.UNPLANNED -> {
button_add_to_plan.text = getString(R.string.action_add_to_plan)
button_add_to_plan.setOnClickListener { _ ->
taskViewModel.addTaskToPlan(task)
loadData()
}
progress_layout.visibility = View.GONE
}
Task.PLANNED -> {
button_add_to_plan.text = getString(R.string.action_remove_from_plan)
button_add_to_plan.setOnClickListener { _ ->
taskViewModel.removeTaskFromPlan(task)
loadData()
}
progress_layout.visibility = View.GONE
}
Task.IN_PROGRESS, Task.FINISHED -> {
button_start_now.text = getString(R.string.action_restart)
button_add_to_plan.text = getString(R.string.action_abolish)
button_add_to_plan.setOnClickListener { _ ->
taskViewModel.abolishTask(task)
loadData()
}
progress_layout.visibility = View.VISIBLE
val percentage = task.getTimeUsedPercentage()
val progressAnimator = ObjectAnimator.ofInt(progress, "progress", progress.progress, percentage)
progressAnimator.duration = 200
progressAnimator.start()
text_progress_done.text = String.format(getString(R.string.period_done), percentage)
text_progress_left.text = if (task.getStatus() == Task.IN_PROGRESS)
String.format(getString(R.string.period_left), "${(task.getTimeExpected() - task.getTimeUsed()) / 24 / 3600} days")
else getString(R.string.period_left_finished)
}
}
}
companion object {
const val TAG = "TaskDetailActivity"
const val EXTRA_TASK = "extra_task"
fun actionStart(context: Context, task: Task) {
val intent = Intent(context, TaskDetailActivity::class.java)
intent.putExtra(EXTRA_TASK, task)
context.startActivity(intent)
}
fun actionStart(context: Context, task: Task, options: ActivityOptions) {
val intent = Intent(context, TaskDetailActivity::class.java)
intent.putExtra(EXTRA_TASK, task)
context.startActivity(intent, options.toBundle())
}
}
}
| 44.544872 | 135 | 0.671032 |
1d4b1af9b799c0c4d2b4247308b10192e06fafe8 | 1,069 | dart | Dart | lib/myapp.dart | theamiri/zahn | b09930a18d5d23f042959bc37dadd313fb3606c4 | [
"MIT"
] | 1 | 2021-07-27T22:44:57.000Z | 2021-07-27T22:44:57.000Z | lib/myapp.dart | theamiri/zahn | b09930a18d5d23f042959bc37dadd313fb3606c4 | [
"MIT"
] | null | null | null | lib/myapp.dart | theamiri/zahn | b09930a18d5d23f042959bc37dadd313fb3606c4 | [
"MIT"
] | 1 | 2021-07-27T18:11:01.000Z | 2021-07-27T18:11:01.000Z | import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:sizer/sizer.dart';
import 'logic/app_bloc/app_bloc.dart';
import 'logic/colorization_bloc/colorization_bloc.dart';
import 'presentation/common/theme/app_theme.dart';
import 'presentation/routes/app_routes.dart';
class MyApp extends StatelessWidget {
final AppRouter appRouter = AppRouter();
@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider<AppBloc>(create: (_) => AppBloc()),
BlocProvider<ColorizationBloc>(create: (_) => ColorizationBloc()),
],
child: LayoutBuilder(
builder: (context, constraints) {
return Sizer(
builder: (context, orientation, screenType) => MaterialApp(
title: 'ZAHN - Colorize old Photos',
theme: AppTheme.defaultTheme,
debugShowCheckedModeBanner: false,
onGenerateRoute: appRouter.onGenerateRoute,
),
);
},
),
);
}
}
| 32.393939 | 74 | 0.653882 |
bcb76c3ad336ed864c2ffdb7c6ce702d0106c5ca | 532 | swift | Swift | Asepsis/summaryViewController.swift | pateldevang/Asepsis | 9048e81bbb663458856ef43882d53cc2750514d6 | [
"MIT"
] | null | null | null | Asepsis/summaryViewController.swift | pateldevang/Asepsis | 9048e81bbb663458856ef43882d53cc2750514d6 | [
"MIT"
] | null | null | null | Asepsis/summaryViewController.swift | pateldevang/Asepsis | 9048e81bbb663458856ef43882d53cc2750514d6 | [
"MIT"
] | null | null | null | //
// summaryViewController.swift
// Asepsis
//
// Created by Devang Patel on 21/09/19.
// Copyright © 2019 Devang Patel. All rights reserved.
//
import UIKit
import Firebase
class summaryViewController: UIViewController {
//MARK: - Outlets
@IBOutlet weak var identity: UILabel!
@IBOutlet weak var weigth: UILabel!
var test1 = String()
var test2 = String()
override func viewDidLoad() {
super.viewDidLoad()
identity.text = test1
weigth.text = test2
}
}
| 18.344828 | 55 | 0.633459 |
e56dcaa52c2119d26ada9fd9e7239477107785ea | 167 | sql | SQL | sql_test_files/dw_misth_fylo_form.sql | gmai2006/grammar | a6a27a152cd1ce03e221ce625054f96dbbdd9194 | [
"MIT"
] | 1 | 2021-12-24T13:43:38.000Z | 2021-12-24T13:43:38.000Z | sql_test_files/dw_misth_fylo_form.sql | gmai2006/grammar | a6a27a152cd1ce03e221ce625054f96dbbdd9194 | [
"MIT"
] | 2 | 2021-05-02T18:37:16.000Z | 2021-09-07T05:07:07.000Z | sql_test_files/dw_misth_fylo_form.sql | gmai2006/grammar | a6a27a152cd1ce03e221ce625054f96dbbdd9194 | [
"MIT"
] | 2 | 2021-10-05T08:16:50.000Z | 2022-01-01T04:01:21.000Z | select misth_fylo.kodfylo, misth_fylo.kodxrisi, misth_fylo.descfylo from misth_fylo WHERE misth_fylo.kodfylo = :arg_kodfylo and misth_fylo.kodxrisi = :arg_kodxrisi | 167 | 167 | 0.832335 |
c31ad5f631e1ef363e85be920d9956499b5a67cc | 548 | kt | Kotlin | app/src/main/java/io/github/drumber/kitsune/data/model/media/Titles.kt | Drumber/Kitsune | 6f4466e8bd6049bd6b0fef833dd098f164e93219 | [
"Apache-2.0"
] | 6 | 2022-01-06T18:39:35.000Z | 2022-03-16T11:22:12.000Z | app/src/main/java/io/github/drumber/kitsune/data/model/media/Titles.kt | Drumber/Kitsune | 6f4466e8bd6049bd6b0fef833dd098f164e93219 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/io/github/drumber/kitsune/data/model/media/Titles.kt | Drumber/Kitsune | 6f4466e8bd6049bd6b0fef833dd098f164e93219 | [
"Apache-2.0"
] | null | null | null | package io.github.drumber.kitsune.data.model.media
import android.os.Parcelable
import com.fasterxml.jackson.annotation.JsonProperty
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@Parcelize
data class Titles(
@JsonProperty("en")
@SerialName("en")
val en: String? = null,
@JsonProperty("en_jp")
@SerialName("en_jp")
val enJp: String? = null,
@JsonProperty("ja_jp")
@SerialName("ja_jp")
val jaJp: String? = null
) : Parcelable
| 24.909091 | 52 | 0.739051 |
a4ac6fdc8ce584432f4e8c95a58f0e60b9c2a83c | 390 | kt | Kotlin | app/src/main/java/com/eugeneek/dicontainer/di/CounterScope.kt | eugeneek/Injector | 9778ebe406d711a4bbb73ab73238b3798d2b66c9 | [
"MIT"
] | 5 | 2019-10-24T16:48:43.000Z | 2019-11-05T21:18:21.000Z | app/src/main/java/com/eugeneek/dicontainer/di/CounterScope.kt | eugeneek/Injector | 9778ebe406d711a4bbb73ab73238b3798d2b66c9 | [
"MIT"
] | null | null | null | app/src/main/java/com/eugeneek/dicontainer/di/CounterScope.kt | eugeneek/Injector | 9778ebe406d711a4bbb73ab73238b3798d2b66c9 | [
"MIT"
] | null | null | null | package com.eugeneek.dicontainer.di
import com.eugeneek.dicontainer.Counter
import com.eugeneek.dicontainer.CounterIncrementer
import com.eugeneek.injector.Scope
class CounterScope: Scope() {
override fun init() {
val counter = Counter(0)
val counterIncrementer = CounterIncrementer(
counter = counter
)
bind(counterIncrementer)
}
} | 20.526316 | 52 | 0.697436 |
9693fc76f362aded59f882020b6c30a47ed16781 | 2,683 | swift | Swift | iOS App/Application/AppServerConfigs.swift | LaudateCorpus1/ar-cx-accelerator | bf371719d51e02bb8aad9597ded69187c315d2b0 | [
"UPL-1.0",
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | 6 | 2020-02-28T03:58:25.000Z | 2021-06-14T22:30:06.000Z | iOS App/Application/AppServerConfigs.swift | LaudateCorpus1/ar-cx-accelerator | bf371719d51e02bb8aad9597ded69187c315d2b0 | [
"UPL-1.0",
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | iOS App/Application/AppServerConfigs.swift | LaudateCorpus1/ar-cx-accelerator | bf371719d51e02bb8aad9597ded69187c315d2b0 | [
"UPL-1.0",
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | 3 | 2019-11-02T21:33:38.000Z | 2022-02-18T04:38:27.000Z | //
// *********************************************************************************************
// Copyright © 2019. Oracle and/or its affiliates. All rights reserved.
// Licensed under the Universal Permissive License v 1.0 as shown at
// http://oss.oracle.com/licenses/upl
// *********************************************************************************************
// Accelerator Package: Augmented CX
// Date: 3/8/19 11:59 AM
// *********************************************************************************************
// File: AppServerConfigs.swift
// *********************************************************************************************
//
import UIKit
protocol AppServerConfigsDelegate: class {
/**
Notifies the delegate when configs are being retrieved from the server.
*/
func gettingServerConfigs()
/**
Notifies the delegate that the configs request is completed.
- Parameter result: Flag to indicate that configs were successfully received.
*/
func serverConfigsRetrieved(_ result: Bool)
}
/**
This extension will provide default implementation for the delegate allowing the methods to be optional for the implementing class.
*/
extension AppServerConfigsDelegate {
func gettingServerConfigs() {}
}
class AppServerConfigs {
/**
Delegate for this class.
*/
weak var delegate: AppServerConfigsDelegate?
/**
Variable to get server configs from different components of the application.
*/
private(set) var serverConfigs: ServerConfigs?
/**
Variable to indicate if getting server configs.
*/
private(set) var gettingServerConfigs: Bool = false
// MARK: - Object Methods
/**
Convenience initialization method that assigns a delegate to this class during init.
- Parameter delegate: The instance of the delegate to assign to this class.
*/
convenience init(delegate: AppServerConfigsDelegate) {
self.init()
self.delegate = delegate
self.delegate?.gettingServerConfigs()
self.gettingServerConfigs = true
(UIApplication.shared.delegate as! AppDelegate).integrationBroker.getServerConfigs { result in
DispatchQueue.main.async {
switch result {
case .success(let configs):
self.gettingServerConfigs = false
self.serverConfigs = configs
self.delegate?.serverConfigsRetrieved(true)
default:
self.delegate?.serverConfigsRetrieved(false)
}
}
}
}
}
| 32.325301 | 132 | 0.551249 |
2a14dfb3792162b6c65f9f44228153817e003e31 | 14 | sql | SQL | lib/index.test.down.sql | victorvuelma/knex-migrate-sql-file | 906c11f8cb9ab6a637b7d858efbdd5f194a42e1b | [
"MIT"
] | 12 | 2018-06-16T15:29:04.000Z | 2021-11-04T15:55:13.000Z | lib/index.test.down.sql | victorvuelma/knex-sql-file-migration | 906c11f8cb9ab6a637b7d858efbdd5f194a42e1b | [
"MIT"
] | 4 | 2018-06-18T19:29:04.000Z | 2021-10-07T20:06:10.000Z | lib/index.test.down.sql | victorvuelma/knex-sql-file-migration | 906c11f8cb9ab6a637b7d858efbdd5f194a42e1b | [
"MIT"
] | 5 | 2019-01-04T17:39:05.000Z | 2022-03-31T17:01:25.000Z | SELECT 'down'
| 7 | 13 | 0.714286 |
a1c070d99baa2521557ba70646058680bbbcb386 | 3,672 | h | C | hal/targets/hal/TARGET_ONSEMI/TARGET_NCS36510/crossbar_map.h | matthewelse/mbed-os | dce72d52fbb106eac148e00cbc20e03259c40425 | [
"Apache-2.0"
] | null | null | null | hal/targets/hal/TARGET_ONSEMI/TARGET_NCS36510/crossbar_map.h | matthewelse/mbed-os | dce72d52fbb106eac148e00cbc20e03259c40425 | [
"Apache-2.0"
] | null | null | null | hal/targets/hal/TARGET_ONSEMI/TARGET_NCS36510/crossbar_map.h | matthewelse/mbed-os | dce72d52fbb106eac148e00cbc20e03259c40425 | [
"Apache-2.0"
] | null | null | null | /**
******************************************************************************
* @file crossbar_map.h
* @brief CROSSBAR hw module register map
* @internal
* @author ON Semiconductor
* $Rev: 3318 $
* $Date: 2015-03-27 16:29:34 +0530 (Fri, 27 Mar 2015) $
******************************************************************************
* @copyright (c) 2012 ON Semiconductor. All rights reserved.
* ON Semiconductor is supplying this software for use with ON Semiconductor
* processor based microcontrollers only.
*
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
* @endinternal
*
* @ingroup crossbar
*
* @details
*/
#ifndef CROSSB_MAP_H_
#define CROSSB_MAP_H_
/*************************************************************************************************
* *
* Header files *
* *
*************************************************************************************************/
#include "architecture.h"
/**************************************************************************************************
* *
* Type definitions *
* *
**************************************************************************************************/
/* Crossbar Control HW Structure Overlay */
typedef struct {
__IO uint32_t DIOCTRL0; /**< Switch IO0 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL1; /**< Switch IO1 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL2; /**< Switch IO2 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL3; /**< Switch IO3 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL4; /**< Switch IO4 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL5; /**< Switch IO5 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL6; /**< Switch IO6 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL7; /**< Switch IO7 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL8; /**< Switch IO8 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL9; /**< Switch IO9 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL10; /**< Switch IO10 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL11; /**< Switch IO11 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL12; /**< Switch IO12 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL13; /**< Switch IO13 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL14; /**< Switch IO14 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL15; /**< Switch IO15 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL16; /**< Switch IO16 to GPIO(default) or peripheral device */
__IO uint32_t DIOCTRL17; /**< Switch IO17 to GPIO(default) or peripheral device */
} CrossbReg_t, *CrossbReg_pt;
#endif /* CROSSB_MAP_H_ */
| 55.636364 | 99 | 0.50463 |
b2f31c9fa591aa64a9a9b71a93c94ca32cdaf220 | 910 | dart | Dart | digilog_clock/lib/main.dart | Jagrajsinghji/flutter_clock | 86b3f0a1470239e201a22af4482331f172534870 | [
"MIT"
] | null | null | null | digilog_clock/lib/main.dart | Jagrajsinghji/flutter_clock | 86b3f0a1470239e201a22af4482331f172534870 | [
"MIT"
] | null | null | null | digilog_clock/lib/main.dart | Jagrajsinghji/flutter_clock | 86b3f0a1470239e201a22af4482331f172534870 | [
"MIT"
] | null | null | null | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:flutter_clock_helper/customizer.dart';
import 'package:flutter_clock_helper/model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'digilog_clock.dart';
void main() {
// A temporary measure until Platform supports web and TargetPlatform supports
// macOS.
if (!kIsWeb && Platform.isMacOS) {
// TODO(gspencergoog): Update this when TargetPlatform includes macOS.
// https://github.com/flutter/flutter/issues/31366
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override.
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
}
runApp(ClockCustomizer((ClockModel model) => DigiLogClock(model)));
}
| 36.4 | 91 | 0.759341 |
c49e83955d7413738f31d66b2689639c26226016 | 492 | h | C | XHSmartHomeSystem/XHImageView.h | xspyhack/SmartHomeSystem-iOS | a5f2cf6e1f1e0215c6200d11b6e655e75fbf706c | [
"MIT"
] | 1 | 2015-05-19T05:49:07.000Z | 2015-05-19T05:49:07.000Z | XHSmartHomeSystem/XHImageView.h | xspyhack/SmartHomeSystem-iOS | a5f2cf6e1f1e0215c6200d11b6e655e75fbf706c | [
"MIT"
] | null | null | null | XHSmartHomeSystem/XHImageView.h | xspyhack/SmartHomeSystem-iOS | a5f2cf6e1f1e0215c6200d11b6e655e75fbf706c | [
"MIT"
] | null | null | null | //
// XHImageView.h
// XHSmartHomeSystem
//
// Created by bl4ckra1sond3tre on 4/12/15.
// Copyright (c) 2015 bl4ckra1sond3tre. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XHImageView : UIView {
CAShapeLayer *arcLayer;
UIBezierPath *path;
}
/* the backgroundColor must clear */
@property (nonatomic) NSString *imageName;
@property (nonatomic) UIColor *color; //progress color
@property (nonatomic) CGFloat progress;
@property (nonatomic) CGFloat lineWidth;
@end
| 22.363636 | 61 | 0.727642 |
40cd9c32554a07796408225c4b0f64fdef4676c2 | 6,814 | html | HTML | docs/custom-heading-image.html | sadiel/columbiabritanica | 674cb754e67824bf976e7573070c3a226079ab16 | [
"MIT"
] | null | null | null | docs/custom-heading-image.html | sadiel/columbiabritanica | 674cb754e67824bf976e7573070c3a226079ab16 | [
"MIT"
] | 9 | 2020-07-17T16:26:07.000Z | 2022-03-03T22:46:45.000Z | docs/custom-heading-image.html | sadiel/columbiabritanica | 674cb754e67824bf976e7573070c3a226079ab16 | [
"MIT"
] | null | null | null | <!doctype html>
<html lang="en">
<!--
Apply head only for dev environment, this is required for jekyll to
insert livereload scripts
-->
<head>
<meta charset="utf-8">
<title>Custom Heading Image - Columbia Británica</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<!-- Define a description for better SEO result -->
<meta name="description" content="This is an example of custom post heading image. You can simply add the following setting to your post front-matter field: heading-img: svg/heading-image.svg heading-img-local: true heading-img-width: 400 In Almace Scaffolding v1.1.0, the original svg-headline*, and img-headline* options are depr...">
<!-- Cheome Web App theme color -->
<meta name="theme-color" content="#ff00b4">
<!-- Feed URL -->
<link rel="alternate" href="/feed.xml" type="application/atom+xml">
<!-- Site icons -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><link rel="icon" href="/favicon.png" type="image/png"><link rel="icon" href="/favicon.svg?assets-inline-assets-keep" sizes="any" type="image/svg+xml"><link rel="mask-icon" href="/mask-icon.svg" color="#ff00b4">
<!-- Chrome Web App manifest -->
<link rel="manifest" href="/manifest.json">
<!-- Main CSS -->
<link rel="stylesheet" href="/assets/themes/curtana/css/app.css?assets-inline">
<!-- Canonical links, avoid duplicate content problems -->
<link rel="canonical" href="http://0.0.0.0:4321/custom-heading-image.html">
<!-- DNS prefetching for static files -->
<!-- Head hooks -->
</head>
<!-- Open Graph and Twitter Cards support -->
<meta property="og:type" content="article">
<meta property="og:site_name" content="Columbia Británica">
<meta property="og:title" content="Custom Heading Image">
<meta property="og:url" content="http://0.0.0.0:4321/custom-heading-image.html">
<meta property="og:description" content="This is an example of custom post heading image. You can simply add the following setting to your post front-matter field: heading-img: svg/heading-image.svg heading-img-local: true heading-img-width: 400 In Almace Scaffolding v1.1.0, the original svg-headline*, and img-headline* options are depr...">
<meta property="og:image" content="http://0.0.0.0:4321/logo.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@columbiabritanica">
<meta name="twitter:creator" content="@tunghsiao">
<meta property="article:published_time" content="2014-02-01T00:00:00+00:00">
<meta property="article:modified_time" content="2018-08-10T14:04:53+00:00">
<meta name="twitter:label1" value="Words">
<meta name="twitter:data1" value="182 words">
<meta name="twitter:label2" value="Reading time">
<meta name="twitter:data2" value="Less than 1 min">
<!-- Post specified styles -->
<style data-assets-inline>
:root {
}
body {
}
</style>
<!-- Main navigation with current page / categoriy highlighted -->
<nav class="navigation">
<ul>
<li >
<a href="/">Columbia Británica</a>
</li>
<li >
<a href="/acercade/">Acerca de</a>
</li>
</ul>
</nav>
<!-- Main content wrap -->
<main class="content " role=main>
<!-- Post-wide custom CSS -->
<!-- Article wrapper, limit width -->
<article lang="en">
<!-- Post title -->
<header style=" ">
<h1 class="image-title" title="Custom Heading Image" data-title="Custom Heading Image">
Custom Heading Image
<img
src="/assets/svg/heading-image-example.svg"style="width: 50vw;">
</h1>
<small>
By <span rel="author">Tunghsiao Liu</span>
on <time datetime="2014-02-01T00:00:00+00:00">Feb 1, 2014</time>
</small>
</header>
<!-- Post content -->
<div class="post-content">
<p>This is an example of custom post heading image. You can simply add the following setting to your post <a href="https://jekyllrb.com/docs/frontmatter/">front-matter field</a>:</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">heading-img</span><span class="pi">:</span> <span class="s">svg/heading-image.svg</span>
<span class="na">heading-img-local</span><span class="pi">:</span> <span class="no">true</span>
<span class="na">heading-img-width</span><span class="pi">:</span> <span class="s">400</span>
</code></pre></div></div>
<blockquote>
<p>In Almace Scaffolding v1.1.0, the original <code class="highlighter-rouge">svg-headline*</code>, and <code class="highlighter-rouge">img-headline*</code> options are deprecated.</p>
</blockquote>
<dl>
<dt><code class="highlighter-rouge">heading-img</code></dt>
<dd>Heading image filename, if a relative URL (non-external URL) is provided, the file will be prefixed with <code class="highlighter-rouge">site.file</code>.</dd>
<dt><code class="highlighter-rouge">heading-img-local</code></dt>
<dd>To avoid relative URL prefixed by <code class="highlighter-rouge">site.file</code>, you can set this option to <code class="highlighter-rouge">true</code> to prefix it with <code class="highlighter-rouge">amsf_user_assets</code>, then you can store your images in <code class="highlighter-rouge">_app/assets/</code>.</dd>
<dt><code class="highlighter-rouge">heading-img-width</code></dt>
<dd>Set the width of your heading image. The value will be converted to viewport unit automatically. ie. <code class="highlighter-rouge">heading-img-width: 400</code> will be converted to <code class="highlighter-rouge">width: 40vw</code>;</dd>
</dl>
<blockquote>
<p><strong>Pro Tips</strong>: Keep a <code class="highlighter-rouge"><title></code> tag for your SVG can help Safari generate correct post title for its Reader mode:</p>
</blockquote>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><svg</span> <span class="na">xmlns=</span><span class="s">"http://www.w3.org/2000/svg"</span><span class="nt">></span>
<span class="nt"><title></span>Cool Article<span class="nt"></title></span>
…
</code></pre></div></div>
</div>
</article>
</main>
<!-- Footer section -->
<footer class="footer">
<ul>
<li><a href="/">Columbia Británica</a></li>
<li>
<a href="https://sparanoid.com/lab/amsf/" title="Almace Scaffolding with theme Curtana">AMSF</a>
</li>
</ul>
</footer>
<!-- Theme scripts -->
<script src="/assets/themes/curtana/js/app.js?assets-inline"></script>
<!-- User scripts -->
<script src="/assets/js/user.js?assets-inline"></script>
<!-- Lightense Images -->
<!-- Service Worker -->
<!-- Google Analytics -->
<!-- Foot hooks -->
<!-- Finale -->
</html>
| 31.693023 | 343 | 0.669357 |